diff options
Diffstat (limited to 'initd/runlst.c')
-rw-r--r-- | initd/runlst.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/initd/runlst.c b/initd/runlst.c index 908ec15..ee8c5c5 100644 --- a/initd/runlst.c +++ b/initd/runlst.c @@ -37,15 +37,28 @@ static NORETURN void split_and_exec(char *cmd) while (*cmd != '\0') { argv[i++] = cmd; /* FIXME: buffer overflow!! */ - while (*cmd != '\0' && !isspace(*cmd)) - ++cmd; + if (*cmd == '"') { + while (*cmd != '\0' && *cmd != '"') { + if (cmd[0] == '\\' && cmd[1] != '\0') + ++cmd; + + ++cmd; + } - if (isspace(*cmd)) { - *(cmd++) = '\0'; + if (*cmd == '"') + *(cmd++) = '\0'; - while (isspace(*cmd)) + unescape(argv[i - 1]); + } else { + while (*cmd != '\0' && *cmd != ' ') ++cmd; + + if (*cmd == ' ') + *(cmd++) = '\0'; } + + while (*cmd == ' ') + ++cmd; } argv[i] = NULL; |