mirror of
https://github.com/sheumann/hush.git
synced 2025-01-03 00:31:16 +00:00
The version checked into the tree is a snapshot of an unifinished applet, and
you just made lots of ">>>>>>> mine" lines show up in my working copy of this. Please don't do that again.
This commit is contained in:
parent
eb84a42fdd
commit
4ef6f647a3
14
shell/bbsh.c
14
shell/bbsh.c
@ -1,5 +1,5 @@
|
|||||||
/* vi: set ts=4 :
|
/* vi: set ts=4 :
|
||||||
*
|
*
|
||||||
* bbsh - busybox shell
|
* bbsh - busybox shell
|
||||||
*
|
*
|
||||||
* Copyright 2006 Rob Landley <rob@landley.net>
|
* Copyright 2006 Rob Landley <rob@landley.net>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
// What we know about a single process.
|
// What we know about a single process.
|
||||||
struct command {
|
struct command {
|
||||||
struct command *next;
|
struct command *next;
|
||||||
int flags; // exit, suspend, && ||
|
int flags; // exit, suspend, && ||
|
||||||
int pid; // pid (or exit code)
|
int pid; // pid (or exit code)
|
||||||
int argc;
|
int argc;
|
||||||
char *argv[0];
|
char *argv[0];
|
||||||
@ -125,9 +125,9 @@ static char *parse_pipeline(char *cmdline, struct pipeline *line)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate next command structure if necessary
|
// Allocate next command structure if necessary
|
||||||
if (!*cmd) *cmd = xzalloc(sizeof(struct command)+8*sizeof(char *));
|
if (!*cmd) *cmd = xzalloc(sizeof(struct command)+8*sizeof(char *));
|
||||||
|
|
||||||
// Parse next argument and add the results to argv[]
|
// Parse next argument and add the results to argv[]
|
||||||
end = parse_word(start, cmd);
|
end = parse_word(start, cmd);
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ static char *parse_pipeline(char *cmdline, struct pipeline *line)
|
|||||||
start++;
|
start++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// handle | & < > >> << || &&
|
// handle | & < > >> << || &&
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ static int run_pipeline(struct pipeline *line)
|
|||||||
if (cmd->argc==2 && !strcmp(cmd->argv[0],"cd"))
|
if (cmd->argc==2 && !strcmp(cmd->argv[0],"cd"))
|
||||||
chdir(cmd->argv[1]);
|
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);
|
exit(cmd->argc>1 ? atoi(cmd->argv[1]) : 0);
|
||||||
else {
|
else {
|
||||||
int status;
|
int status;
|
||||||
pid_t pid=fork();
|
pid_t pid=fork();
|
||||||
@ -217,6 +217,6 @@ int bbsh_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (ENABLE_FEATURE_CLEAN_UP) free(command);
|
if (ENABLE_FEATURE_CLEAN_UP) free(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user