From 2f02ce4005075ac76742ed6a2189cc2e5fc6a192 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 24 Jun 2010 04:55:57 +0200 Subject: utils: show help blurb when run without any arguments --- src/install.c | 4 ++-- src/notify.c | 9 +++++++++ src/systemctl.c | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/install.c b/src/install.c index 0c9f086663..f56c0728b9 100644 --- a/src/install.c +++ b/src/install.c @@ -132,7 +132,7 @@ static int parse_argv(int argc, char *argv[]) { } if (optind >= argc) { - log_error("Missing verb."); + help(); return -EINVAL; } @@ -143,7 +143,7 @@ static int parse_argv(int argc, char *argv[]) { else if (streq(argv[optind], "test")) arg_action = ACTION_TEST; else { - log_error("Unknown verb %s", argv[optind]); + log_error("Unknown verb %s.", argv[optind]); return -EINVAL; } diff --git a/src/notify.c b/src/notify.c index 6dd708a900..514636e472 100644 --- a/src/notify.c +++ b/src/notify.c @@ -115,6 +115,15 @@ static int parse_argv(int argc, char *argv[]) { } } + if (optind >= argc && + !arg_ready && + !arg_status && + !arg_pid && + !arg_booted) { + help(); + return -EINVAL; + } + return 1; } diff --git a/src/systemctl.c b/src/systemctl.c index 9eb72f9747..78310aa273 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -1839,7 +1839,7 @@ static int telinit_parse_argv(int argc, char *argv[]) { } if (optind >= argc) { - log_error("Argument missing."); + telinit_help(); return -EINVAL; } -- cgit v1.2.3-54-g00ecf