aboutsummaryrefslogtreecommitdiff
path: root/initd
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-04 14:03:23 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-04 14:08:12 +0200
commit56e6004336aeb3a7e92e8418430217c42feb2515 (patch)
tree348e853614697e828b091150716b1c4198f75ca7 /initd
parentca7b7c15c5ecd344e844411e4b8409e552a3b06d (diff)
Simplifiy service file syntax
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'initd')
-rw-r--r--initd/runlst.c23
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;