- Fix handling of the case when multiple patterns are specified in a single
command line argument, separated by newlines PR: bin/173673 Submitted by: ache MFC after: 1 week
This commit is contained in:
parent
bf70b87555
commit
e411593d4b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=245057
@ -479,7 +479,13 @@ main(int argc, char *argv[])
|
|||||||
grepbehave = GREP_EXTENDED;
|
grepbehave = GREP_EXTENDED;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
add_pattern(optarg, strlen(optarg));
|
{
|
||||||
|
char *token;
|
||||||
|
char *string = strdup(optarg);
|
||||||
|
|
||||||
|
while ((token = strsep(&string, "\n")) != NULL)
|
||||||
|
add_pattern(token, strlen(token));
|
||||||
|
}
|
||||||
needpattern = 0;
|
needpattern = 0;
|
||||||
break;
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
@ -668,7 +674,11 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Process patterns from command line */
|
/* Process patterns from command line */
|
||||||
if (aargc != 0 && needpattern) {
|
if (aargc != 0 && needpattern) {
|
||||||
add_pattern(*aargv, strlen(*aargv));
|
char *token;
|
||||||
|
char *string = strdup(*aargv);
|
||||||
|
|
||||||
|
while ((token = strsep(&string, "\n")) != NULL)
|
||||||
|
add_pattern(token, strlen(token));
|
||||||
--aargc;
|
--aargc;
|
||||||
++aargv;
|
++aargv;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user