diff options
author | Karel Zak <kzak@redhat.com> | 2016-11-04 10:50:06 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2016-11-09 10:02:32 +0100 |
commit | d4625442c7f0974b32a81f56c2e96dd71c2be184 (patch) | |
tree | 2f983e6cd8e60738ae71e94e95c6968979905c9e | |
parent | 4775cc69a7c20a905b368291370530ce329b8203 (diff) | |
download | util-linux-d4625442c7f0974b32a81f56c2e96dd71c2be184.tar.gz |
lsmem: cleanup for --summary=only
* don't fill scols table
* check for collision with raw,pairs and json options
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | sys-utils/lsmem.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys-utils/lsmem.c b/sys-utils/lsmem.c index 3ac1fd3bea..8ffd40975d 100644 --- a/sys-utils/lsmem.c +++ b/sys-utils/lsmem.c @@ -493,6 +493,17 @@ int main(int argc, char **argv) if (argc != optind) lsmem_usage(stderr); + if (lsmem->want_table + lsmem->want_summary == 0) + errx(EXIT_FAILURE, _("options --{raw,json,pairs} and --summary=only are mutually exclusive")); + + /* Shortcut to avoid scols machinery on --summary=only */ + if (lsmem->want_table == 0 && lsmem->want_summary) { + read_basic_info(lsmem); + read_info(lsmem); + print_summary(lsmem); + return EXIT_SUCCESS; + } + /* * Default columns */ |