aboutsummaryrefslogtreecommitdiff
path: root/sh/sh.c
diff options
context:
space:
mode:
Diffstat (limited to 'sh/sh.c')
-rw-r--r--sh/sh.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/sh/sh.c b/sh/sh.c
index b914272..84572c0 100644
--- a/sh/sh.c
+++ b/sh/sh.c
@@ -93,6 +93,7 @@ void commandLoop(FILE *filstr) {
struct sigaction signal_action;
char *prompt = getenv("PS1");
char *path = getenv("PATH");
+ char *token, *tokenstate;
char *command[4096];
pid_t isparent;
char name[4096];
@@ -117,9 +118,18 @@ void commandLoop(FILE *filstr) {
break;
}
name[strlen(name) - 1] = 0;
- command_argc = splitCommand(name, command); /* See parser.c */
- if ((errno = parseCommand(command_argc, command)) != 0 /* See parser.c */ ) {
- printf("sh: %s: %s\n", command[0], strerror(errno));
+ if ((token = strtok_r(name, ";", &tokenstate)) != NULL) {
+ for (; token != NULL;) {
+ command_argc = splitCommand(token, command); /* See parser.c */
+ if ((errno = parseCommand(command_argc, command)) != 0 /* See parser.c */ )
+ printf("sh: %s: %s\n", command[0], strerror(errno));
+ token = strtok_r(NULL, ";", &tokenstate);
+ }
+ }
+ else {
+ command_argc = splitCommand(token, command); /* See parser.c */
+ if ((errno = parseCommand(command_argc, command)) != 0 /* See parser.c */ )
+ printf("sh: %s: %s\n", command[0], strerror(errno));
}
}
}