summaryrefslogtreecommitdiff
path: root/servicecmd/enable.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-03-25 01:59:38 +0100
committerDavid Oberhollenzer <david.oberhollenzer@tele2.at>2018-03-25 01:59:38 +0100
commitb9d829bc9abe0f5ce0234475505b33fe5b942cb4 (patch)
tree62254553207ba3af0e11e5a4bc3b19407cc4cf2a /servicecmd/enable.c
parentf97add9041c7cf330d2743b1dca9267676bdaa72 (diff)
Cleanup command error handling in "service"
- Add helper for checking number of arguments - Add helper for printing "please read help" message Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
Diffstat (limited to 'servicecmd/enable.c')
-rw-r--r--servicecmd/enable.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/servicecmd/enable.c b/servicecmd/enable.c
index 73ea01e..5d4195e 100644
--- a/servicecmd/enable.c
+++ b/servicecmd/enable.c
@@ -31,18 +31,15 @@ static int cmd_enable(int argc, char **argv)
int ret = EXIT_FAILURE;
struct stat sb;
- if (argc < 2 || argc > 3) {
- fputs("Wrong number of arguments for `enable'.\n"
- "Try `service help enable' for more information.\n",
- stderr);
+ if (check_arguments(argv[0], argc, 2, 3))
return EXIT_FAILURE;
- }
for (ptr = argv[1]; isalnum(*ptr) || *ptr == '_'; ++ptr)
;
if (*ptr != '\0') {
fprintf(stderr, "Invalid service name '%s'\n", argv[1]);
+ tell_read_help(argv[0]);
return EXIT_FAILURE;
}