summaryrefslogtreecommitdiffstats
path: root/tools/dmsetup.c
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2010-03-08 16:05:07 +0000
committerMilan Broz <mbroz@redhat.com>2010-03-08 16:05:07 +0000
commitc948101ccdb00cb65d21bfdba58c7afe4011f66d (patch)
tree286a071c99144951cef319f9046e26b933097024 /tools/dmsetup.c
parentab5933d4acc526094d92459e39dccdadcf70950c (diff)
downloadlvm2-c948101ccdb00cb65d21bfdba58c7afe4011f66d.tar.gz
lvm2-c948101ccdb00cb65d21bfdba58c7afe4011f66d.tar.xz
lvm2-c948101ccdb00cb65d21bfdba58c7afe4011f66d.zip
Add --help dmsetup option as the synonym for help command.
Diffstat (limited to 'tools/dmsetup.c')
-rw-r--r--tools/dmsetup.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 74af6f19..69fa1287 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -124,6 +124,7 @@ enum {
EXEC_ARG,
FORCE_ARG,
GID_ARG,
+ HELP_ARG,
INACTIVE_ARG,
MAJOR_ARG,
MINOR_ARG,
@@ -2720,7 +2721,8 @@ static void _usage(FILE *out)
int i;
fprintf(out, "Usage:\n\n");
- fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n"
+ fprintf(out, "dmsetup [--version] [-h|--help [-c|-C|--columns]]\n"
+ " [-v|--verbose [-v|--verbose ...]]\n"
" [-r|--readonly] [--noopencount] [--nolockfs] [--inactive]\n"
" [--udevcookie] [--noudevrules] [--noudevsync] [-y|--yes]\n"
" [--readahead [+]<sectors>|auto|none]\n"
@@ -3083,6 +3085,7 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
{"exec", 1, &ind, EXEC_ARG},
{"force", 0, &ind, FORCE_ARG},
{"gid", 1, &ind, GID_ARG},
+ {"help", 0, &ind, HELP_ARG},
{"inactive", 0, &ind, INACTIVE_ARG},
{"major", 1, &ind, MAJOR_ARG},
{"minor", 1, &ind, MINOR_ARG},
@@ -3167,10 +3170,12 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
optarg = 0;
optind = OPTIND_INIT;
- while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfG:j:m:M:no:O:ru:U:vy",
+ while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfG:hj:m:M:no:O:ru:U:vy",
long_options, NULL)) != -1) {
if (c == ':' || c == '?')
return 0;
+ if (c == 'h' || ind == HELP_ARG)
+ _switches[HELP_ARG]++;
if (c == 'c' || c == 'C' || ind == COLS_ARG)
_switches[COLS_ARG]++;
if (c == 'f' || ind == FORCE_ARG)
@@ -3329,6 +3334,11 @@ int main(int argc, char **argv)
goto out;
}
+ if (_switches[HELP_ARG]) {
+ c = _find_command("help");
+ goto doit;
+ }
+
if (_switches[VERSION_ARG]) {
c = _find_command("version");
goto doit;