1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00
freebsd/usr.bin/grep
Ed Maste 87c485cfb5 bsdgrep: fix matching behaviour
- Set REG_NOTBOL if we've already matched beginning of line and we're
  examining later parts

- For each pattern we examine, apply it to the remaining bits of the
  line rather than (potentially) smaller subsets

- Check for REG_NOSUB after we've looked at all patterns initially
  matching the line

- Keep track of the last match we made to later determine if we're
  simply not matching any longer or if we need to proceed another byte
  because we hit a zero-length match

- Match the earliest and longest bit of each line before moving the
  beginning of what we match to further in the line, past the end of the
  longest match; this generally matches how gnugrep(1) seems to behave,
  and seems like pretty good behavior to me

- Finally, bail out of printing any matches if we were set to print all
  (empty pattern) but -o (output matches) was set

PR:		195763, 180990, 197555, 197531, 181263, 209116
Submitted by:	"Kyle Evans" <kevans91@ksu.edu>
Reviewed by:	cem
MFC after:	1 month
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D10104
2017-04-03 23:16:51 +00:00
..
nls
regex Fix a segfault in bsdgrep when parsing the invalid extended regexps "?" 2016-08-02 20:25:22 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
file.c bsdgrep: fix EOF handling with --mmap 2017-02-19 17:23:27 +00:00
grep.1 bsdgrep: document ignored option -u 2017-02-19 17:40:24 +00:00
grep.c bsdgrep: treat rgrep as grep -r 2017-04-03 21:10:02 +00:00
grep.h
Makefile Bump GCC max-inline-insns-single in libiconv_modules and grep 2015-07-26 00:11:04 +00:00
Makefile.depend
queue.c
util.c bsdgrep: fix matching behaviour 2017-04-03 23:16:51 +00:00