freebsd-nq/usr.bin/grep
Kyle Evans f823c6dc73 grep: fix null pattern and empty pattern file behavior
The null pattern semantics were terrible because I tried to match gnugrep,
but I got it wrong.  Let's unwind that:

- The null pattern should match every line if neither -w nor -x.
- The null pattern should match empty lines if -x.
- The null pattern should not match any lines if -w.

The first two will stop processing (shortcut) even if additional patterns
are specified. In any other case, we will continue processing other
patterns.  If no other patterns are specified beside a null pattern, then
we match if neither -w nor -x or set and do not match if either of those
are specified.

The justification for -w is that it should match on a whole word, but the
null pattern deos not have a whole word to match on.

Empty pattern files should never match anything, and more importantly, -v
should cause everything to be written.

PR:		253209
MFC-after:	4 days
2021-02-04 20:59:42 -06:00
..
tests grep: tests: stop testing for a nonexistent version of grep 2020-12-25 15:16:33 -06:00
file.c Fix -Wpointer-sign warnings in usr.bin/grep 2020-09-21 09:03:37 +00:00
grep.1 grep(1): Add more EXAMPLES 2020-11-19 18:58:15 +00:00
grep.c grep: fix null pattern and empty pattern file behavior 2021-02-04 20:59:42 -06:00
grep.h grep: replace the internal queue with a ring buffer 2020-12-09 05:27:45 +00:00
Makefile grep: fix LINKS in Makefile 2021-01-18 11:22:48 +01:00
Makefile.depend Update Makefile.depend files 2019-12-11 17:37:53 +00:00
Makefile.depend.options
queue.c grep: replace the internal queue with a ring buffer 2020-12-09 05:27:45 +00:00
util.c grep: fix null pattern and empty pattern file behavior 2021-02-04 20:59:42 -06:00
zgrep.1 Fix some regressions with the zgrep(1) wrapper. 2020-07-20 23:57:53 +00:00
zgrep.sh bzgrep: make flag --no-filename work 2020-11-20 09:56:46 +00:00