From b5b43f276e3ca7556ddf66f2d95cac8169af4355 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Tue, 24 Apr 2018 21:59:23 +0100 Subject: swapon: add --output-all option Signed-off-by: Sami Kerola --- bash-completion/swapon | 1 + sys-utils/swapon.8 | 3 +++ sys-utils/swapon.c | 8 +++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bash-completion/swapon b/bash-completion/swapon index 4a53ec5ac..f5136efd3 100644 --- a/bash-completion/swapon +++ b/bash-completion/swapon @@ -50,6 +50,7 @@ _swapon_module() --priority --summary --show + --output-all --noheadings --raw --bytes diff --git a/sys-utils/swapon.8 b/sys-utils/swapon.8 index 3c66c8188..b8fc8be71 100644 --- a/sys-utils/swapon.8 +++ b/sys-utils/swapon.8 @@ -160,6 +160,9 @@ Display a definable table of swap areas. See the .B \-\-help output for a list of available columns. .TP +.B \-\-output\-all +Output all available columns. +.TP .B \-\-noheadings Do not print headings when displaying .B \-\-show diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c index 757601ae6..4ef2f1c9d 100644 --- a/sys-utils/swapon.c +++ b/sys-utils/swapon.c @@ -846,7 +846,8 @@ int main(int argc, char *argv[]) BYTES_OPTION = CHAR_MAX + 1, NOHEADINGS_OPTION, RAW_OPTION, - SHOW_OPTION + SHOW_OPTION, + OPT_LIST_TYPES }; static const struct option long_opts[] = { @@ -861,6 +862,7 @@ int main(int argc, char *argv[]) { "verbose", no_argument, NULL, 'v' }, { "version", no_argument, NULL, 'V' }, { "show", optional_argument, NULL, SHOW_OPTION }, + { "output-all", no_argument, NULL, OPT_LIST_TYPES }, { "noheadings", no_argument, NULL, NOHEADINGS_OPTION }, { "raw", no_argument, NULL, RAW_OPTION }, { "bytes", no_argument, NULL, BYTES_OPTION }, @@ -951,6 +953,10 @@ int main(int argc, char *argv[]) } ctl.show = 1; 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: ctl.no_heading = 1; break; -- cgit v1.2.3-55-g7522