aboutsummaryrefslogtreecommitdiff
path: root/servicecmd
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-11 16:07:20 +0200
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-04-11 16:08:25 +0200
commit71d98c150f6242fcf1b8a5845e46db56caad3885 (patch)
tree96cc861544c214039eb61cf38df170a6d9190acb /servicecmd
parent4ee0ea9754d4c8103a623c90c03b68457c71581f (diff)
Don't split dependencies into argument vector, keep list of strings
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'servicecmd')
-rw-r--r--servicecmd/list.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/servicecmd/list.c b/servicecmd/list.c
index 404bddc..b9e342a 100644
--- a/servicecmd/list.c
+++ b/servicecmd/list.c
@@ -21,7 +21,8 @@
static void print_services(service_t *svc)
{
- size_t i;
+ const char *ptr;
+ int i;
for (; svc != NULL; svc = svc->next) {
printf("Name: %s\n", svc->name);
@@ -32,18 +33,24 @@ static void print_services(service_t *svc)
if (svc->type == SVC_RESPAWN && svc->rspwn_limit > 0)
printf("\tRespawn limit: %d\n", svc->rspwn_limit);
- if (svc->before != NULL) {
+ ptr = svc->before;
+ if (ptr != NULL && svc->num_before > 0) {
fputs("\tMust be run before:\n", stdout);
- for (i = 0; svc->before[i] != NULL; ++i)
- printf("\t\t%s\n", svc->before[i]);
+ for (i = 0; i < svc->num_before; ++i) {
+ printf("\t\t%s\n", ptr);
+ ptr += strlen(ptr) + 1;
+ }
}
- if (svc->after != NULL) {
+ ptr = svc->after;
+ if (ptr != NULL && svc->num_after > 0) {
fputs("\tMust be run after:\n", stdout);
- for (i = 0; svc->after[i] != NULL; ++i)
- printf("\t\t%s\n", svc->after[i]);
+ for (i = 0; i < svc->num_after; ++i) {
+ printf("\t\t%s\n", ptr);
+ ptr += strlen(ptr) + 1;
+ }
}
}
}