diff options
author | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-04-04 14:58:01 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@tele2.at> | 2018-04-04 14:58:01 +0200 |
commit | 04a23330e4a2085ee91980c223c5e4f089ebbe97 (patch) | |
tree | da0b02615fb21849a37cf4632c80df1569788dff /lib/src/svc_tsort.c | |
parent | aa1356cb190a3416936b25f75ecaaa8684c6fcde (diff) |
Merge preprocessing of command lines
- Common function for splitting string into argument vector
- Preprocess & split command lines while parsing the service file
- Specify "before" and "after" dependencies in a single line
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'lib/src/svc_tsort.c')
-rw-r--r-- | lib/src/svc_tsort.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/src/svc_tsort.c b/lib/src/svc_tsort.c index 50517f2..dcd1b4c 100644 --- a/lib/src/svc_tsort.c +++ b/lib/src/svc_tsort.c @@ -27,14 +27,18 @@ static bool has_dependencies(service_t *list, service_t *svc) size_t i; while (list != NULL) { - for (i = 0; i < svc->num_after; ++i) { - if (!strcmp(svc->after[i], list->name)) - return true; + if (svc->after != NULL) { + for (i = 0; svc->after[i] != NULL; ++i) { + if (!strcmp(svc->after[i], list->name)) + return true; + } } - for (i = 0; i < list->num_before; ++i) { - if (!strcmp(list->before[i], svc->name)) - return true; + if (list->before != NULL) { + for (i = 0; list->before[i] != NULL; ++i) { + if (!strcmp(list->before[i], svc->name)) + return true; + } } list = list->next; |