diff options
Diffstat (limited to 'user/sh.c')
-rw-r--r-- | user/sh.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -76,14 +76,14 @@ runcmd(struct cmd *cmd) if(ecmd->argv[0] == 0) exit(); exec(ecmd->argv[0], ecmd->argv); - printf(2, "exec %s failed\n", ecmd->argv[0]); + fprintf(2, "exec %s failed\n", ecmd->argv[0]); break; case REDIR: rcmd = (struct redircmd*)cmd; close(rcmd->fd); if(open(rcmd->file, rcmd->mode) < 0){ - printf(2, "open %s failed\n", rcmd->file); + fprintf(2, "open %s failed\n", rcmd->file); exit(); } runcmd(rcmd->cmd); @@ -133,7 +133,7 @@ runcmd(struct cmd *cmd) int getcmd(char *buf, int nbuf) { - printf(2, "$ "); + fprintf(2, "$ "); memset(buf, 0, nbuf); gets(buf, nbuf); if(buf[0] == 0) // EOF @@ -161,7 +161,7 @@ main(void) // Chdir must be called by the parent, not the child. buf[strlen(buf)-1] = 0; // chop \n if(chdir(buf+3) < 0) - printf(2, "cannot cd %s\n", buf+3); + fprintf(2, "cannot cd %s\n", buf+3); continue; } if(fork1() == 0) @@ -174,7 +174,7 @@ main(void) void panic(char *s) { - printf(2, "%s\n", s); + fprintf(2, "%s\n", s); exit(); } @@ -334,7 +334,7 @@ parsecmd(char *s) cmd = parseline(&s, es); peek(&s, es, ""); if(s != es){ - printf(2, "leftovers: %s\n", s); + fprintf(2, "leftovers: %s\n", s); panic("syntax"); } nulterminate(cmd); |