diff options
Diffstat (limited to 'sh.c')
| -rw-r--r-- | sh.c | 22 | 
1 files changed, 11 insertions, 11 deletions
| @@ -66,7 +66,7 @@ runcmd(struct cmd *cmd)    if(cmd == 0)      exit(); -   +    switch(cmd->type){    default:      panic("runcmd"); @@ -120,7 +120,7 @@ runcmd(struct cmd *cmd)      wait();      wait();      break; -     +    case BACK:      bcmd = (struct backcmd*)cmd;      if(fork1() == 0) @@ -146,7 +146,7 @@ main(void)  {    static char buf[100];    int fd; -   +    // Ensure that three file descriptors are open.    while((fd = open("console", O_RDWR)) >= 0){      if(fd >= 3){ @@ -154,7 +154,7 @@ main(void)        break;      }    } -   +    // Read and run input commands.    while(getcmd(buf, sizeof(buf)) >= 0){      if(buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' '){ @@ -182,7 +182,7 @@ int  fork1(void)  {    int pid; -   +    pid = fork();    if(pid == -1)      panic("fork"); @@ -267,7 +267,7 @@ gettoken(char **ps, char *es, char **q, char **eq)  {    char *s;    int ret; -   +    s = *ps;    while(s < es && strchr(whitespace, *s))      s++; @@ -300,7 +300,7 @@ gettoken(char **ps, char *es, char **q, char **eq)    }    if(eq)      *eq = s; -   +    while(s < es && strchr(whitespace, *s))      s++;    *ps = s; @@ -311,7 +311,7 @@ int  peek(char **ps, char *es, char *toks)  {    char *s; -   +    s = *ps;    while(s < es && strchr(whitespace, *s))      s++; @@ -419,7 +419,7 @@ parseexec(char **ps, char *es)    int tok, argc;    struct execcmd *cmd;    struct cmd *ret; -   +    if(peek(ps, es, "("))      return parseblock(ps, es); @@ -458,7 +458,7 @@ nulterminate(struct cmd *cmd)    if(cmd == 0)      return 0; -   +    switch(cmd->type){    case EXEC:      ecmd = (struct execcmd*)cmd; @@ -477,7 +477,7 @@ nulterminate(struct cmd *cmd)      nulterminate(pcmd->left);      nulterminate(pcmd->right);      break; -     +    case LIST:      lcmd = (struct listcmd*)cmd;      nulterminate(lcmd->left); | 
