initctl: Show available services if none given

In case a user forgets to type in the service to enable, disable, or
touch, we try to be helpful and list available services instead of
bugging out.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2018-03-06 18:41:36 +01:00
parent b8e6954c46
commit 90249e50ef
+9
View File
@@ -131,6 +131,9 @@ int serv_enable(char *arg)
char link[80];
char path[80];
if (!arg || !arg[0])
return serv_list(NULL);
if (!strstr(arg, ".conf")) {
snprintf(corr, sizeof(corr), "%s.conf", arg);
arg = corr;
@@ -154,6 +157,9 @@ int serv_disable(char *arg)
char link[80];
struct stat st;
if (!arg || !arg[0])
return serv_list(NULL);
if (!strstr(arg, ".conf")) {
snprintf(corr, sizeof(corr), "%s.conf", arg);
arg = corr;
@@ -173,6 +179,9 @@ int serv_touch(char *arg)
{
char corr[40];
if (!arg || !arg[0])
return serv_list(NULL);
if (!strstr(arg, ".conf")) {
snprintf(corr, sizeof(corr), "%s.conf", arg);
arg = corr;