@@ -, +, @@ --- src/rc/runscript.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) --- a/src/rc/runscript.c +++ a/src/rc/runscript.c @@ -1100,7 +1100,8 @@ runscript(int argc, char **argv) { bool doneone = false; int retval, opt, depoptions = RC_DEP_TRACE; - RC_STRING *svc; + RC_STRINGLIST *extra_commands; + RC_STRING *svc, *command; char path[PATH_MAX], lnk[PATH_MAX], *dir, *save = NULL, pidstr[10]; size_t l = 0, ll; const char *file; @@ -1269,6 +1270,9 @@ runscript(int argc, char **argv) applet_list = rc_stringlist_new(); rc_stringlist_add(applet_list, applet); + if ((extra_commands = rc_service_extra_commands(service)) == NULL) + eerrorx("failed to determine extra commands"); + /* Now run each option */ retval = EXIT_SUCCESS; while (optind < argc) { @@ -1287,7 +1291,11 @@ runscript(int argc, char **argv) doneone = true; - if (strcmp(optarg, "describe") == 0 || + TAILQ_FOREACH(command, extra_commands, entries) + if (strcmp(optarg, command->value) == 0) break; + + if (command != NULL || + strcmp(optarg, "describe") == 0 || strcmp(optarg, "help") == 0 || strcmp(optarg, "depend") == 0) { @@ -1391,5 +1399,6 @@ runscript(int argc, char **argv) usage(EXIT_FAILURE); } + rc_stringlist_free(extra_commands); return retval; } --