diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/bbsh.c | 12 | ||||
-rw-r--r-- | shell/msh.c | 24 |
2 files changed, 18 insertions, 18 deletions
diff --git a/shell/bbsh.c b/shell/bbsh.c index 6bef368..8f0fb05 100644 --- a/shell/bbsh.c +++ b/shell/bbsh.c @@ -68,7 +68,7 @@ struct pipeline { static void free_list(void *list, void (*freeit)(void *data)) { - while(list) { + while (list) { void **next = (void **)list; void *list_next = *next; freeit(list); @@ -159,12 +159,12 @@ static int run_pipeline(struct pipeline *line) // Handle local commands. This is totally fake and plastic. if (cmd->argc==2 && !strcmp(cmd->argv[0],"cd")) chdir(cmd->argv[1]); - else if(!strcmp(cmd->argv[0],"exit")) + else if (!strcmp(cmd->argv[0],"exit")) exit(cmd->argc>1 ? atoi(cmd->argv[1]) : 0); else { int status; pid_t pid=fork(); - if(!pid) { + if (!pid) { run_applet_and_exit(cmd->argv[0],cmd->argc,cmd->argv); execvp(cmd->argv[0],cmd->argv); printf("No %s",cmd->argv[0]); @@ -179,7 +179,7 @@ static void free_cmd(void *data) { struct command *cmd=(struct command *)data; - while(cmd->argc) free(cmd->argv[--cmd->argc]); + while (cmd->argc) free(cmd->argv[--cmd->argc]); } @@ -211,8 +211,8 @@ int bbsh_main(int argc, char **argv) else { unsigned cmdlen=0; for (;;) { - if(!f) putchar('$'); - if(1 > getline(&command, &cmdlen,f ? : stdin)) break; + if (!f) putchar('$'); + if (1 > getline(&command, &cmdlen,f ? : stdin)) break; handle(command); } diff --git a/shell/msh.c b/shell/msh.c index 963e594..4d1e84c 100644 --- a/shell/msh.c +++ b/shell/msh.c @@ -92,21 +92,21 @@ extern char **environ; #ifdef MSHDEBUG int mshdbg = MSHDEBUG; -#define DBGPRINTF(x) if(mshdbg>0)printf x -#define DBGPRINTF0(x) if(mshdbg>0)printf x -#define DBGPRINTF1(x) if(mshdbg>1)printf x -#define DBGPRINTF2(x) if(mshdbg>2)printf x -#define DBGPRINTF3(x) if(mshdbg>3)printf x -#define DBGPRINTF4(x) if(mshdbg>4)printf x -#define DBGPRINTF5(x) if(mshdbg>5)printf x -#define DBGPRINTF6(x) if(mshdbg>6)printf x -#define DBGPRINTF7(x) if(mshdbg>7)printf x -#define DBGPRINTF8(x) if(mshdbg>8)printf x -#define DBGPRINTF9(x) if(mshdbg>9)printf x +#define DBGPRINTF(x) if (mshdbg>0) printf x +#define DBGPRINTF0(x) if (mshdbg>0) printf x +#define DBGPRINTF1(x) if (mshdbg>1) printf x +#define DBGPRINTF2(x) if (mshdbg>2) printf x +#define DBGPRINTF3(x) if (mshdbg>3) printf x +#define DBGPRINTF4(x) if (mshdbg>4) printf x +#define DBGPRINTF5(x) if (mshdbg>5) printf x +#define DBGPRINTF6(x) if (mshdbg>6) printf x +#define DBGPRINTF7(x) if (mshdbg>7) printf x +#define DBGPRINTF8(x) if (mshdbg>8) printf x +#define DBGPRINTF9(x) if (mshdbg>9) printf x int mshdbg_rc = 0; -#define RCPRINTF(x) if(mshdbg_rc)printf x +#define RCPRINTF(x) if (mshdbg_rc) printf x #else |