[multipath] add '-h' option
authorChristophe Varoqui <cvaroqui@zezette.localdomain>
Thu, 19 Oct 2006 20:24:58 +0000 (22:24 +0200)
committerChristophe Varoqui <cvaroqui@zezette.localdomain>
Thu, 19 Oct 2006 20:24:58 +0000 (22:24 +0200)
Calling 'multipath -h' always added the line 'Unknown switch: (null)' in
front of the usage text since '-h' was not defined.
This patch just adds the '-h' option.

Volker Sameske, IBM

multipath/main.c
multipath/multipath.8

index b6f8814..a5f122e 100644 (file)
@@ -72,7 +72,7 @@ static void
 usage (char * progname)
 {
        fprintf (stderr, VERSION_STRING);
-       fprintf (stderr, "Usage: %s\t[-v level] [-d] [-l|-ll|-f|-F]\n",
+       fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F]\n",
                progname);
        fprintf (stderr,
                "\t\t\t[-p failover|multibus|group_by_serial|group_by_prio]\n" \
@@ -83,6 +83,7 @@ usage (char * progname)
                "\t   1\t\t\tprint created devmap names only\n" \
                "\t   2\t\t\tdefault verbosity\n" \
                "\t   3\t\t\tprint debug information\n" \
+               "\t-h\t\tprint this usage text\n" \
                "\t-b file\t\tbindings file location\n" \
                "\t-d\t\tdry run, do not create or update devmaps\n" \
                "\t-l\t\tshow multipath topology (sysfs and DM info)\n" \
@@ -323,7 +324,7 @@ main (int argc, char *argv[])
        if (load_config(DEFAULT_CONFIGFILE))
                exit(1);
 
-       while ((arg = getopt(argc, argv, ":dl::FfM:v:p:b:")) != EOF ) {
+       while ((arg = getopt(argc, argv, ":dhl::FfM:v:p:b:")) != EOF ) {
                switch(arg) {
                case 1: printf("optarg : %s\n",optarg);
                        break;
@@ -366,6 +367,8 @@ main (int argc, char *argv[])
                                usage(argv[0]);
                        }                
                        break;
+               case 'h':
+                       usage(argv[0]);
                case ':':
                        fprintf(stderr, "Missing option arguement\n");
                        usage(argv[0]);        
index 70a7801..693872b 100644 (file)
@@ -6,7 +6,7 @@ multipath \- Device mapper target autoconfig
 .RB [\| \-v\ \c
 .IR verbosity \|]
 .RB [\| \-d \|]
-.RB [\| \-l | \-ll | \-f | \-F \|]
+.RB [\| \-h | \-l | \-ll | \-f | \-F \|]
 .RB [\| \-p\ \c
 .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
 .RB [\| device \|]
@@ -29,6 +29,9 @@ print the created or updated multipath names only, for use to feed other tools l
 print all info : detected paths, coalesced paths (ie multipaths) and device maps
 .RE
 .TP
+.B \-h
+print usage text
+.TP
 .B \-d
 dry run, do not create or update devmaps
 .TP