sysctl: exit with error message instead of usage()

Printing usage() output at error is too noisy.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2011-12-18 14:07:34 +01:00
parent 127c82763a
commit 7f99096ded

View File

@ -687,22 +687,22 @@ int main(int argc, char *argv[])
if (preloadfileOpt) if (preloadfileOpt)
return Preload(preloadfile); return Preload(preloadfile);
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc < 1) {
warnx(_("no variables specified"));
Usage(stderr);
}
if (NameOnly && Quiet) {
warnx(_("options -N and -q can not coexist"));
Usage(stderr);
}
if (WriteMode || index(*argv, '=')) if (argc < 1)
ReturnCode = WriteSetting(*argv); errx(EXIT_FAILURE, _("no variables specified\n"
else "Try `%s --help' for more information."),
ReturnCode = ReadSetting(*argv); program_invocation_short_name);
if (NameOnly && Quiet)
errx(EXIT_FAILURE, _("options -N and -q cannot coexist\n"
"Try `%s --help' for more information."),
program_invocation_short_name);
if (WriteMode || index(*argv, '='))
ReturnCode = WriteSetting(*argv);
else
ReturnCode = ReadSetting(*argv);
return ReturnCode; return ReturnCode;
} }