@@ -83,23 +83,23 @@ process shell (
8383
8484 /* Print shell banner and startup message */
8585
86- fprintf (dev , "\n\n%s%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" ,
86+ syscall_fprintf (dev , "\n\n%s%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n" ,
8787 SHELL_BAN0 ,SHELL_BAN1 ,SHELL_BAN2 ,SHELL_BAN3 ,SHELL_BAN4 ,
8888 SHELL_BAN5 ,SHELL_BAN6 ,SHELL_BAN7 ,SHELL_BAN8 ,SHELL_BAN9 );
8989
90- fprintf (dev , "%s\n\n" , SHELL_STRTMSG );
90+ syscall_fprintf (dev , "%s\n\n" , SHELL_STRTMSG );
9191
9292 /* Continually prompt the user, read input, and execute command */
9393
9494 while (TRUE) {
9595
9696 /* Display prompt */
9797
98- fprintf (dev , SHELL_PROMPT );
98+ syscall_fprintf (dev , SHELL_PROMPT );
9999
100100 /* Read a command */
101101
102- len = read (dev , buf , sizeof (buf ));
102+ len = syscall_read (dev , buf , sizeof (buf ));
103103
104104 /* Exit gracefully on end-of-file */
105105
@@ -122,14 +122,14 @@ process shell (
122122 /* Handle parsing error */
123123
124124 if (ntok == SYSERR ) {
125- fprintf (dev ,"%s\n" , SHELL_SYNERRMSG );
125+ syscall_fprintf (dev ,"%s\n" , SHELL_SYNERRMSG );
126126 continue ;
127127 }
128128
129129 /* If line is empty, go to next input line */
130130
131131 if (ntok == 0 ) {
132- fprintf (dev , "\n" );
132+ syscall_fprintf (dev , "\n" );
133133 continue ;
134134 }
135135
@@ -150,7 +150,7 @@ process shell (
150150 if ( (ntok >=3 ) && ( (toktyp [ntok - 2 ] == SH_TOK_LESS )
151151 || (toktyp [ntok - 2 ] == SH_TOK_GREATER ))){
152152 if (toktyp [ntok - 1 ] != SH_TOK_OTHER ) {
153- fprintf (dev ,"%s\n" , SHELL_SYNERRMSG );
153+ syscall_fprintf (dev ,"%s\n" , SHELL_SYNERRMSG );
154154 continue ;
155155 }
156156 if (toktyp [ntok - 2 ] == SH_TOK_LESS ) {
@@ -166,18 +166,18 @@ process shell (
166166 if ( (ntok >=3 ) && ( (toktyp [ntok - 2 ] == SH_TOK_LESS )
167167 || (toktyp [ntok - 2 ] == SH_TOK_GREATER ))){
168168 if (toktyp [ntok - 1 ] != SH_TOK_OTHER ) {
169- fprintf (dev ,"%s\n" , SHELL_SYNERRMSG );
169+ syscall_fprintf (dev ,"%s\n" , SHELL_SYNERRMSG );
170170 continue ;
171171 }
172172 if (toktyp [ntok - 2 ] == SH_TOK_LESS ) {
173173 if (inname != NULL ) {
174- fprintf (dev ,"%s\n" , SHELL_SYNERRMSG );
174+ syscall_fprintf (dev ,"%s\n" , SHELL_SYNERRMSG );
175175 continue ;
176176 }
177177 inname = & tokbuf [tok [ntok - 1 ]];
178178 } else {
179179 if (outname != NULL ) {
180- fprintf (dev ,"%s\n" , SHELL_SYNERRMSG );
180+ syscall_fprintf (dev ,"%s\n" , SHELL_SYNERRMSG );
181181 continue ;
182182 }
183183 outname = & tokbuf [tok [ntok - 1 ]];
@@ -194,7 +194,7 @@ process shell (
194194 }
195195 }
196196 if ((ntok == 0 ) || (i < ntok )) {
197- fprintf (dev , SHELL_SYNERRMSG );
197+ syscall_fprintf (dev , SHELL_SYNERRMSG );
198198 continue ;
199199 }
200200
@@ -224,15 +224,15 @@ process shell (
224224 /* Handle command not found */
225225
226226 if (j >= ncmd ) {
227- fprintf (dev , "command %s not found\n" , tokbuf );
227+ syscall_fprintf (dev , "command %s not found\n" , tokbuf );
228228 continue ;
229229 }
230230
231231 /* Handle built-in command */
232232
233233 if (cmdtab [j ].cbuiltin ) { /* No background or redirect. */
234234 if (inname != NULL || outname != NULL || backgnd ){
235- fprintf (dev , SHELL_BGERRMSG );
235+ syscall_fprintf (dev , SHELL_BGERRMSG );
236236 continue ;
237237 } else {
238238 /* Set up arg vector for call */
@@ -254,25 +254,25 @@ process shell (
254254 /* Open files and redirect I/O if specified */
255255
256256 if (inname != NULL ) {
257- stdinput = open (NAMESPACE ,inname ,"ro" );
257+ stdinput = syscall_open (NAMESPACE ,inname ,"ro" );
258258 if (stdinput == SYSERR ) {
259- fprintf (dev , SHELL_INERRMSG , inname );
259+ syscall_fprintf (dev , SHELL_INERRMSG , inname );
260260 continue ;
261261 }
262262 }
263263 if (outname != NULL ) {
264- stdoutput = open (NAMESPACE ,outname ,"w" );
264+ stdoutput = syscall_open (NAMESPACE ,outname ,"w" );
265265 if (stdoutput == SYSERR ) {
266- fprintf (dev , SHELL_OUTERRMSG , outname );
266+ syscall_fprintf (dev , SHELL_OUTERRMSG , outname );
267267 continue ;
268268 } else {
269- control (stdoutput , F_CTL_TRUNC , 0 , 0 );
269+ syscall_control (stdoutput , F_CTL_TRUNC , 0 , 0 );
270270 }
271271 }
272272
273273 /* Spawn child thread for non-built-in commands */
274274
275- child = create (cmdtab [j ].cfunc ,
275+ child = syscall_create (cmdtab [j ].cfunc ,
276276 SHELL_CMDSTK , SHELL_CMDPRIO ,
277277 cmdtab [j ].cname , 2 , ntok , & tmparg );
278278
@@ -281,7 +281,7 @@ process shell (
281281 if ((child == SYSERR ) ||
282282 (addargs (child , ntok , tok , tlen , tokbuf , & tmparg )
283283 == SYSERR ) ) {
284- fprintf (dev , SHELL_CREATMSG );
284+ syscall_fprintf (dev , SHELL_CREATMSG );
285285 continue ;
286286 }
287287
@@ -290,18 +290,18 @@ process shell (
290290 proctab [child ].prdesc [0 ] = stdinput ;
291291 proctab [child ].prdesc [1 ] = stdoutput ;
292292
293- msg = recvclr ();
294- resume (child );
293+ msg = syscall_recvclr ();
294+ syscall_resume (child );
295295 if (! backgnd ) {
296- msg = receive ();
296+ msg = syscall_receive ();
297297 while (msg != child ) {
298- msg = receive ();
298+ msg = syscall_receive ();
299299 }
300300 }
301301 }
302302
303303 /* Terminate the shell process by returning from the top level */
304304
305- fprintf (dev ,SHELL_EXITMSG );
305+ syscall_fprintf (dev ,SHELL_EXITMSG );
306306 return OK ;
307307}
0 commit comments