]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Tidy up some argument parsing, particularly for -b
authorNeilBrown <neilb@suse.de>
Fri, 29 Jan 2010 03:54:55 +0000 (14:54 +1100)
committerNeilBrown <neilb@suse.de>
Fri, 29 Jan 2010 04:46:17 +0000 (15:46 +1100)
-b only means --brief in MISC mode, elsewhere it is --bitmap.

Resolves-debian-bug: 427777
Signed-off-by: NeilBrown <neilb@suse.de>
mdadm.8
mdadm.c
mdadm.conf.5

diff --git a/mdadm.8 b/mdadm.8
index 29e098b2083179abfa8f93840476f46de7ecc71d..882c3a2fbadd9f1171c917edd800122bc860f3e5 100644 (file)
--- a/mdadm.8
+++ b/mdadm.8
@@ -249,18 +249,6 @@ Avoid printing purely informative messages.  With this,
 .I mdadm
 will be silent unless there is something really important to report.
 
-.TP
-.BR \-b ", " \-\-brief
-Be less verbose.  This is used with
-.B \-\-detail
-and
-.BR \-\-examine .
-Using
-.B \-\-brief
-with
-.B \-\-verbose
-gives an intermediate level of verbosity.
-
 .TP
 .BR \-f ", " \-\-force
 Be more forceful about certain operations.  See the various modes for
@@ -1794,6 +1782,18 @@ For
 .B \-\-scan
 causes all devices listed in the config file to be examined.
 
+.TP
+.BR \-b ", " \-\-brief
+Be less verbose.  This is used with
+.B \-\-detail
+and
+.BR \-\-examine .
+Using
+.B \-\-brief
+with
+.B \-\-verbose
+gives an intermediate level of verbosity.
+
 .SH MONITOR MODE
 
 .HP 12
diff --git a/mdadm.c b/mdadm.c
index 74a39a88584b9bf4ac9885d9b21f534f8d8175f2..d235b2a97e3bf069de30d91790c3adfea750dbc4 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -151,13 +151,10 @@ int main(int argc, char *argv[])
                        continue;
 
                case 'b':
-                       if (mode == ASSEMBLE || mode == BUILD || mode == CREATE || mode == GROW)
+                       if (mode == ASSEMBLE || mode == BUILD || mode == CREATE || mode == GROW ||
+                           mode == INCREMENTAL || mode == MANAGE)
                                break; /* b means bitmap */
                        brief = 1;
-                       if (optarg) {
-                               fprintf(stderr, Name ": -b cannot have any extra immediately after it, sorry.\n");
-                               exit(2);
-                       }
                        continue;
 
                case 'Y': export++;
@@ -267,7 +264,8 @@ int main(int argc, char *argv[])
                                        continue;
                                }
                                /* No mode yet, and this is the second device ... */
-                               fprintf(stderr, Name ": An option must be given to set the mode before a second device is listed\n");
+                               fprintf(stderr, Name ": An option must be given to set the mode before a second device\n"
+                                       "       (%s) is listed\n", optarg);
                                exit(2);
                        }
                        if (option_index >= 0)
@@ -874,7 +872,8 @@ int main(int argc, char *argv[])
                                continue;
                        }
                        /* probable typo */
-                       fprintf(stderr, Name ": bitmap file must contain a '/', or be 'internal', or 'none'\n");
+                       fprintf(stderr, Name ": bitmap file must contain a '/', or be 'internal', or 'none'\n"
+                               "       not '%s'\n", optarg);
                        exit(2);
 
                case O(GROW,BitmapChunk):
index 002e2b37f85050c5c295c854b11c71b1624c011d..1c2ae58f093b604f1321f30dbd84bcc4d66d1dcb 100644 (file)
@@ -380,7 +380,7 @@ preceded by plus or minus is allowed and is usually last.
 
 When
 .I mdadm
-is auto-assembling an array, with via
+is auto-assembling an array, either via
 .I --assemble
 or
 .I --incremental