X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcgtop%2Fcgtop.c;h=e5fc262357c3aad3b517414ff894eef073d4f1bf;hb=486cd82c8f7642016895b72bcc09a1bfe885a783;hp=293a2113bdcbcc9510e34eeb4d0e262b0a6960af;hpb=7ff7394d9e4e9189c30fd018235e6b1728c6f2d0;p=elogind.git diff --git a/src/cgtop/cgtop.c b/src/cgtop/cgtop.c index 293a2113b..e5fc26235 100644 --- a/src/cgtop/cgtop.c +++ b/src/cgtop/cgtop.c @@ -548,7 +548,7 @@ static int display(Hashmap *a) { return 0; } -static void help(void) { +static int help(void) { printf("%s [OPTIONS...]\n\n" "Show top control groups by their resource usage.\n\n" @@ -565,10 +565,8 @@ static void help(void) { " -b --batch Run in batch mode, accepting no input\n" " --depth=DEPTH Maximum traversal depth (default: %d)\n", program_invocation_short_name, arg_depth); -} -static void version(void) { - puts(PACKAGE_STRING " cgtop"); + return 0; } static int parse_argv(int argc, char *argv[]) { @@ -587,7 +585,7 @@ static int parse_argv(int argc, char *argv[]) { { "batch", no_argument, NULL, 'b' }, { "depth", required_argument, NULL, ARG_DEPTH }, { "cpu", optional_argument, NULL, ARG_CPU_TYPE}, - { NULL, 0, NULL, 0 } + {} }; int c; @@ -601,11 +599,11 @@ static int parse_argv(int argc, char *argv[]) { switch (c) { case 'h': - help(); - return 0; + return help(); case ARG_VERSION: - version(); + puts(PACKAGE_STRING); + puts(SYSTEMD_FEATURES); return 0; case ARG_CPU_TYPE: @@ -674,8 +672,7 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; default: - log_error("Unknown option code %c", c); - return -EINVAL; + assert_not_reached("Unhandled option"); } }