pgrep: add warning that pattern exceeeds 15 chars
Add a warning if you specify a command over 15 characters and don't use the -f command. This is a pick of two patches from master:24fd260
pgrep: Fix off by one error in line check4a7f9fc
pgrep - adds warning that pattern exceeds 15 chars without References: !25
This commit is contained in:
7
pgrep.c
7
pgrep.c
@ -830,7 +830,14 @@ static void parse_opts (int argc, char **argv)
|
||||
}
|
||||
|
||||
if (argc - optind == 1)
|
||||
{
|
||||
opt_pattern = argv[optind];
|
||||
if ((!opt_full) && (strlen(opt_pattern) > 15))
|
||||
xwarnx(_("pattern that contains program name longer than 15 characters will result in zero matches\n"
|
||||
"Try `%s -f' option for thorough search."),
|
||||
program_invocation_short_name);
|
||||
}
|
||||
|
||||
else if (argc - optind > 1)
|
||||
xerrx(EXIT_USAGE, _("only one pattern can be provided\n"
|
||||
"Try `%s --help' for more information."),
|
||||
|
Reference in New Issue
Block a user