summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ReadMe.c11
-rw-r--r--mdadm.c15
-rw-r--r--mdadm.h2
3 files changed, 17 insertions, 11 deletions
diff --git a/ReadMe.c b/ReadMe.c
index fa71ec94..b6aac0b3 100644
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -600,3 +600,14 @@ char Help_config[] =
"\n"
;
+char *mode_help[mode_count] = {
+ [0] = Help,
+ [ASSEMBLE] = Help_assemble,
+ [BUILD] = Help_build,
+ [CREATE] = Help_create,
+ [MANAGE] = Help_manage,
+ [MISC] = Help_misc,
+ [MONITOR] = Help_monitor,
+ [GROW] = Help_grow,
+ [INCREMENTAL] = Help_incr,
+};
diff --git a/mdadm.c b/mdadm.c
index 6a632e9e..1d050e4d 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1136,20 +1136,13 @@ int main(int argc, char *argv[])
}
if (print_help) {
- char *help_text = Help;
+ char *help_text;
if (print_help == 2)
help_text = OptionHelp;
else
- switch (mode) {
- case ASSEMBLE : help_text = Help_assemble; break;
- case BUILD : help_text = Help_build; break;
- case CREATE : help_text = Help_create; break;
- case MANAGE : help_text = Help_manage; break;
- case MISC : help_text = Help_misc; break;
- case MONITOR : help_text = Help_monitor; break;
- case GROW : help_text = Help_grow; break;
- case INCREMENTAL:help_text= Help_incr; break;
- }
+ help_text = mode_help[mode];
+ if (help_text == NULL)
+ help_text = Help;
fputs(help_text,stdout);
exit(0);
}
diff --git a/mdadm.h b/mdadm.h
index bda557db..98ea472d 100644
--- a/mdadm.h
+++ b/mdadm.h
@@ -264,6 +264,7 @@ enum mode {
GROW,
INCREMENTAL,
AUTODETECT,
+ mode_count
};
extern char short_options[];
@@ -271,6 +272,7 @@ extern char short_bitmap_options[];
extern char short_bitmap_auto_options[];
extern struct option long_options[];
extern char Version[], Usage[], Help[], OptionHelp[],
+ *mode_help[],
Help_create[], Help_build[], Help_assemble[], Help_grow[],
Help_incr[],
Help_manage[], Help_misc[], Help_monitor[], Help_config[];