From: Lennart Poettering Date: Fri, 9 Feb 2018 15:56:12 +0000 (+0100) Subject: cgtop: add "-1" as shortcut for "--iterations=1" X-Git-Tag: v238~33^2~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4fc9ffab3bd61357ef695bd0d9d4603039fdea4a;p=thirdparty%2Fsystemd.git cgtop: add "-1" as shortcut for "--iterations=1" This is most likely the most useful use of --iterations, and such use for numeric parameters has precedents, let's make this work for cgtop too. --- diff --git a/man/systemd-cgtop.xml b/man/systemd-cgtop.xml index d7ad08ec373..295f2351961 100644 --- a/man/systemd-cgtop.xml +++ b/man/systemd-cgtop.xml @@ -228,6 +228,12 @@ indefinitely. + + + + A shortcut for . + + diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index c68b56568ba..1575cd51ff4 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -713,6 +713,7 @@ static void help(void) { " --recursive=BOOL Sum up process count recursively\n" " -d --delay=DELAY Delay between updates\n" " -n --iterations=N Run for N iterations before exiting\n" + " -1 Shortcut for --iterations=1\n" " -b --batch Run in batch mode, accepting no input\n" " --depth=DEPTH Maximum traversal depth (default: %u)\n" " -M --machine= Show container\n" @@ -749,7 +750,7 @@ static int parse_argv(int argc, char *argv[]) { assert(argc >= 1); assert(argv); - while ((c = getopt_long(argc, argv, "hptcmin:brd:kPM:", options, NULL)) >= 0) + while ((c = getopt_long(argc, argv, "hptcmin:brd:kPM:1", options, NULL)) >= 0) switch (c) { @@ -802,6 +803,10 @@ static int parse_argv(int argc, char *argv[]) { break; + case '1': + arg_iterations = 1; + break; + case 'b': arg_batch = true; break;