[PATCH 3/4] swapon: default to --show if nothing is requested

Sami Kerola
2012-12-28T21:48:34Z

Proposed-by: Karel Zak <kzak@redhat.com>
References: http://www.spinics.net/lists/util-linux-ng/msg07301.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/swapon.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c
index 176be42..7310767 100644
--- a/sys-utils/swapon.c
+++ b/sys-utils/swapon.c
@@ -786,7 +786,7 @@ int main(int argc, char *argv[])
}
argv += optind;

- if (show) {
+ if (show || (!all && !numof_labels() && !numof_uuids() && *argv == NULL)) {
if (!ncolumns) {
/* default columns */
columns[ncolumns++] = COL_PATH;
@@ -799,9 +799,6 @@ int main(int argc, char *argv[])
return status;
}

- if (!all && !numof_labels() && !numof_uuids() && *argv == NULL)
- usage(stderr);
-
if (ifexists && !all)
usage(stderr);

--
1.8.0.3