From: seb Date: Sat, 27 Apr 2013 08:08:23 +0000 (+0200) Subject: Allow for more options to be grouped together. X-Git-Tag: v10.1.6~20 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c49e726ad83d42e61841984cd179ae9a5572919;p=sysstat Allow for more options to be grouped together. Sysstat command options can now be 'collapsed' (grouped) when not followed by an argument. So it's now possible for example to enter 'iostat -px 2 5' since no device name is given to option -p. This also concerns pidstat option -U: You can now enter for example 'pidstat -wU' to display switching activity for tasks together with their user name. --- diff --git a/CHANGES b/CHANGES index 5e3dd62..6a4a2d1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ Changes: xxxx/xx/xx: Version 10.1.6 - Sebastien Godard (sysstat orange.fr) + * Sysstat command options can now be 'collapsed' (grouped) when + not followed by an argument. So it's now possible for example + to enter 'iostat -px 2 5' since no device name is given to + option -p. This also concerns pidstat option -U. * Typos fixed. README file updated. * Yet another cosmetic fix in pidstat manual page. diff --git a/iostat.c b/iostat.c index 171d9ae..93a503c 100644 --- a/iostat.c +++ b/iostat.c @@ -1320,6 +1320,7 @@ int main(int argc, char **argv) /* Process args... */ while (opt < argc) { + /* -p option used individually. See below for grouped use */ if (!strcmp(argv[opt], "-p")) { flags |= I_D_PARTITIONS; if (argv[++opt] && @@ -1457,6 +1458,11 @@ int main(int argc, char **argv) flags |= I_D_DEVMAP_NAME; break; + case 'p': + /* If option -p is grouped then it cannot take an arg */ + flags |= I_D_PARTITIONS + I_D_PART_ALL; + break; + case 'T': /* Display stats only for the groups */ flags |= I_D_GROUP_TOTAL_ONLY; diff --git a/pidstat.c b/pidstat.c index bc22aa8..e2dce18 100644 --- a/pidstat.c +++ b/pidstat.c @@ -2110,6 +2110,7 @@ int main(int argc, char **argv) } } + /* Option used individually. See below for grouped option */ else if (!strcmp(argv[opt], "-U")) { /* Display username instead of UID */ pidflag |= P_D_USERNAME; @@ -2167,6 +2168,11 @@ int main(int argc, char **argv) pidflag |= P_D_TID; break; + case 'U': + /* When option is grouped, it cannot take an arg */ + pidflag |= P_D_USERNAME; + break; + case 'u': /* Display CPU usage */ actflag |= P_A_CPU;