pgrep: 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:
parent
003d388922
commit
46d5d44734
28
pgrep.c
28
pgrep.c
@ -732,27 +732,29 @@ static void parse_opts (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(opt_lock && !opt_pidfile){
|
if(opt_lock && !opt_pidfile)
|
||||||
warnx(_("-L without -F makes no sense"));
|
errx(EXIT_FAILURE, _("-L without -F makes no sense\n"
|
||||||
usage(0);
|
"Try `%s --help' for more information."),
|
||||||
}
|
program_invocation_short_name);
|
||||||
|
|
||||||
if(opt_pidfile){
|
if(opt_pidfile){
|
||||||
opt_pid = read_pidfile();
|
opt_pid = read_pidfile();
|
||||||
if(!opt_pid){
|
if(!opt_pid)
|
||||||
warnx(_("pidfile not valid"));
|
errx(EXIT_FAILURE, _("pidfile not valid\n"
|
||||||
usage(0);
|
"Try `%s --help' for more information."),
|
||||||
}
|
program_invocation_short_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc - optind == 1)
|
if (argc - optind == 1)
|
||||||
opt_pattern = argv[optind];
|
opt_pattern = argv[optind];
|
||||||
else if (argc - optind > 1)
|
else if (argc - optind > 1)
|
||||||
usage (0);
|
errx(EXIT_FAILURE, _("only one pattern can be provided\n"
|
||||||
else if (criteria_count == 0) {
|
"Try `%s --help' for more information."),
|
||||||
warnx(_("no matching criteria specified"));
|
program_invocation_short_name);
|
||||||
usage (0);
|
else if (criteria_count == 0)
|
||||||
}
|
errx(EXIT_FAILURE, _("no matching criteria specified\n"
|
||||||
|
"Try `%s --help' for more information."),
|
||||||
|
program_invocation_short_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user