]> err.no Git - systemd/commitdiff
utils: show help blurb when run without any arguments
authorLennart Poettering <lennart@poettering.net>
Thu, 24 Jun 2010 02:55:57 +0000 (04:55 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 24 Jun 2010 02:55:57 +0000 (04:55 +0200)
src/install.c
src/notify.c
src/systemctl.c

index 0c9f0866631d0b2fb89d2e6fa7dcef852b4e8af9..f56c0728b932e768357c7ce51ea859529f92ffe8 100644 (file)
@@ -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;
         }
 
index 6dd708a90077ead6cad638afd0af11e54de1188e..514636e47208ae310d67b3c174a6406251f6bcd1 100644 (file)
@@ -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;
 }
 
index 9eb72f9747c492462f97fdb35866f0f7f00ab510..78310aa273859a988e2bfc6bc70f1d0d70898672 100644 (file)
@@ -1839,7 +1839,7 @@ static int telinit_parse_argv(int argc, char *argv[]) {
         }
 
         if (optind >= argc) {
-                log_error("Argument missing.");
+                telinit_help();
                 return -EINVAL;
         }