Display brief help if no options for list.
authorBen Laurie <ben@links.org>
Wed, 30 Sep 2015 11:17:52 +0000 (12:17 +0100)
committerBen Laurie <ben@links.org>
Wed, 30 Sep 2015 12:55:56 +0000 (13:55 +0100)
Reviewed-by: Andy Polyakov <appro@openssl.org>
apps/openssl.c

index 1c9ce13bd8aebce7a2edeb2eaa7d097f03d6f357..81a37629d1727aed1ad5837aca0f0c33ae94ec62 100644 (file)
@@ -493,11 +493,12 @@ int list_main(int argc, char **argv)
 {
     char *prog;
     HELPLIST_CHOICE o;
 {
     char *prog;
     HELPLIST_CHOICE o;
+    int done = 0;
 
     prog = opt_init(argc, argv, list_options);
     while ((o = opt_next()) != OPT_EOF) {
         switch (o) {
 
     prog = opt_init(argc, argv, list_options);
     while ((o = opt_next()) != OPT_EOF) {
         switch (o) {
-        case OPT_EOF:
+        case OPT_EOF:  /* Never hit, but suppresses warning */
         case OPT_ERR:
             BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
             return 1;
         case OPT_ERR:
             BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
             return 1;
@@ -526,6 +527,12 @@ int list_main(int argc, char **argv)
             list_disabled();
             break;
         }
             list_disabled();
             break;
         }
+        done = 1;
+    }
+
+    if (!done) {
+        BIO_printf(bio_err, "%s: Use -help for summary.\n", prog);
+        return 1;
     }
 
     return 0;
     }
 
     return 0;