swapon: add --output-all option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2018-04-24 21:59:23 +01:00
parent 4dfd172dd8
commit b5b43f276e
No known key found for this signature in database
GPG Key ID: A9553245FDE9B739
3 changed files with 11 additions and 1 deletions

View File

@ -50,6 +50,7 @@ _swapon_module()
--priority --priority
--summary --summary
--show --show
--output-all
--noheadings --noheadings
--raw --raw
--bytes --bytes

View File

@ -160,6 +160,9 @@ Display a definable table of swap areas. See the
.B \-\-help .B \-\-help
output for a list of available columns. output for a list of available columns.
.TP .TP
.B \-\-output\-all
Output all available columns.
.TP
.B \-\-noheadings .B \-\-noheadings
Do not print headings when displaying Do not print headings when displaying
.B \-\-show .B \-\-show

View File

@ -846,7 +846,8 @@ int main(int argc, char *argv[])
BYTES_OPTION = CHAR_MAX + 1, BYTES_OPTION = CHAR_MAX + 1,
NOHEADINGS_OPTION, NOHEADINGS_OPTION,
RAW_OPTION, RAW_OPTION,
SHOW_OPTION SHOW_OPTION,
OPT_LIST_TYPES
}; };
static const struct option long_opts[] = { static const struct option long_opts[] = {
@ -861,6 +862,7 @@ int main(int argc, char *argv[])
{ "verbose", no_argument, NULL, 'v' }, { "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' }, { "version", no_argument, NULL, 'V' },
{ "show", optional_argument, NULL, SHOW_OPTION }, { "show", optional_argument, NULL, SHOW_OPTION },
{ "output-all", no_argument, NULL, OPT_LIST_TYPES },
{ "noheadings", no_argument, NULL, NOHEADINGS_OPTION }, { "noheadings", no_argument, NULL, NOHEADINGS_OPTION },
{ "raw", no_argument, NULL, RAW_OPTION }, { "raw", no_argument, NULL, RAW_OPTION },
{ "bytes", no_argument, NULL, BYTES_OPTION }, { "bytes", no_argument, NULL, BYTES_OPTION },
@ -951,6 +953,10 @@ int main(int argc, char *argv[])
} }
ctl.show = 1; ctl.show = 1;
break; break;
case OPT_LIST_TYPES:
for (ctl.ncolumns = 0; (size_t)ctl.ncolumns < ARRAY_SIZE(infos); ctl.ncolumns++)
ctl.columns[ctl.ncolumns] = ctl.ncolumns;
break;
case NOHEADINGS_OPTION: case NOHEADINGS_OPTION:
ctl.no_heading = 1; ctl.no_heading = 1;
break; break;