From b07491507ca89b28c0cf168abfe4f9bca55e520d Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Mon, 29 Jan 2007 18:37:57 +0000 Subject: [PATCH] add help -c for field list --- dmsetup/dmsetup.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dmsetup/dmsetup.c b/dmsetup/dmsetup.c index 0aa18dd..5aa5df5 100644 --- a/dmsetup/dmsetup.c +++ b/dmsetup/dmsetup.c @@ -1625,7 +1625,7 @@ static int _report_init(struct command *c) if (_switches[SORT_ARG] && _string_args[SORT_ARG]) { keys = _string_args[SORT_ARG]; buffered = 1; - if (!strcmp(c->name, "status") || !strcmp(c->name, "table")) { + if (c && (!strcmp(c->name, "status") || !strcmp(c->name, "table"))) { err("--sort is not yet supported with status and table"); goto out; } @@ -1714,12 +1714,13 @@ static void _usage(FILE *out) fprintf(out, "Usage:\n\n"); fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n" " [-r|--readonly] [--noopencount] [--nolockfs]\n" - " [-c|--columns] [-o ] [--noheadings] [--separator ]\n\n"); + " [-c|--columns] [-o ] [-O|--sort ]\n" + " [--noheadings] [--separator ]\n\n"); for (i = 0; _commands[i].name; i++) fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help); fprintf(out, "\n may be device name or -u or " "-j -m \n"); - fprintf(out, " are comma-separated. Use -c -o help for list.\n"); + fprintf(out, " are comma-separated. Use 'help -c' for list.\n"); fprintf(out, "Table_file contents may be supplied on stdin.\n"); fprintf(out, "Tree options are: ascii, utf, vt100; compact, inverted, notrunc;\n" " [no]device, active, open, rw and uuid.\n"); @@ -1738,6 +1739,14 @@ static int _help(int argc, char **argv, void *data) { _usage(stderr); + if (_switches[COLS_ARG]) { + _switches[OPTIONS_ARG] = 1; + _string_args[OPTIONS_ARG] = (char *) "help"; + _switches[SORT_ARG] = 0; + + (void) _report_init(NULL); + } + return 1; } -- 2.43.5