chiark / gitweb /
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 0c9f086..f56c072 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 6dd708a..514636e 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 9eb72f9..78310aa 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;
         }