X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fmachine-id-setup%2Fmachine-id-setup-main.c;h=85bbfc42991cd1bda21feef04a7237d019ecdf46;hb=154e6f233af028cf76608d49a3b7ed8de61373d8;hp=a67d436dbd7c40a5f305a8ad535ffe220c0b836d;hpb=92f2f92edcad46ce4098ee26504edca0a1dad68e;p=elogind.git diff --git a/src/machine-id-setup/machine-id-setup-main.c b/src/machine-id-setup/machine-id-setup-main.c index a67d436db..85bbfc429 100644 --- a/src/machine-id-setup/machine-id-setup-main.c +++ b/src/machine-id-setup/machine-id-setup-main.c @@ -31,16 +31,13 @@ static const char *arg_root = ""; -static int help(void) { - +static void help(void) { printf("%s [OPTIONS...]\n\n" "Initialize /etc/machine-id from a random source.\n\n" " -h --help Show this help\n" " --version Show package version\n" - " --root Filesystem root\n", + " --root=ROOT Filesystem root\n", program_invocation_short_name); - - return 0; } static int parse_argv(int argc, char *argv[]) { @@ -62,12 +59,13 @@ static int parse_argv(int argc, char *argv[]) { assert(argc >= 0); assert(argv); - while ((c = getopt_long(argc, argv, "hqcv", options, NULL)) >= 0) { + while ((c = getopt_long(argc, argv, "hqcv", options, NULL)) >= 0) switch (c) { case 'h': - return help(); + help(); + return 0; case ARG_VERSION: puts(PACKAGE_STRING); @@ -84,10 +82,9 @@ static int parse_argv(int argc, char *argv[]) { default: assert_not_reached("Unhandled option"); } - } if (optind < argc) { - help(); + log_error("Extraneous arguments"); return -EINVAL; }