When -h or --help is among the given options, most utilities
print a help text, ignoring all other options and arguments.
Make `swapon --summary --help` conform to this general pattern.
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
no_heading, /* toggle --show headers */
raw, /* toggle --show alignment */
show, /* display --show information */
+ summarize, /* display summary of swap use */
verbose; /* be chatty */
};
ctl.fix_page_size = 1;
break;
case 's': /* status report */
- status = display_summary();
- return status;
+ ctl.summarize = 1;
+ break;
case 'v': /* be chatty */
ctl.verbose = 1;
break;
}
argv += optind;
+ if (ctl.summarize) {
+ status = display_summary();
+ return status;
+ }
+
if (ctl.show || (!ctl.all && !numof_labels() && !numof_uuids() && *argv == NULL)) {
if (!ctl.ncolumns) {
/* default columns */