mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user