grep: turn off -w if -x is specified
-x overcomes -w in gnugrep, and it should here as well. Flip it off as needed to avoid confusing other parts of grep.
This commit is contained in:
parent
f823c6dc73
commit
2373acbbb7
@ -30,7 +30,7 @@
|
||||
.\"
|
||||
.\" @(#)grep.1 8.3 (Berkeley) 4/18/94
|
||||
.\"
|
||||
.Dd November 19, 2020
|
||||
.Dd February 4, 2021
|
||||
.Dt GREP 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -405,6 +405,9 @@ and
|
||||
.Sq [[:>:]] ;
|
||||
see
|
||||
.Xr re_format 7 ) .
|
||||
This option has no effect if
|
||||
.Fl x
|
||||
is also specified.
|
||||
.It Fl x , Fl Fl line-regexp
|
||||
Only input lines selected against an entire fixed string or regular
|
||||
expression are considered to be matching lines.
|
||||
|
@ -630,6 +630,10 @@ main(int argc, char *argv[])
|
||||
aargc -= optind;
|
||||
aargv += optind;
|
||||
|
||||
/* xflag takes precedence, don't confuse the matching bits. */
|
||||
if (wflag && xflag)
|
||||
wflag = false;
|
||||
|
||||
/* Fail if we don't have any pattern */
|
||||
if (aargc == 0 && needpattern)
|
||||
usage();
|
||||
|
Loading…
Reference in New Issue
Block a user