Add -z/--null-data support to bsdgrep(1). This brings it more in line with gnugrep(1), and brings us closer to passing the current context tests with bsdgrep(1). 2/3 of the cases in context2 pass just from implementing -z.
Details
- Reviewers
emaste cem - Commits
- rS317049: bsdgrep: add -z/--null-data support
Run kyua tests to make sure this introduced no other regressions
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Ping @emaste, @cem - this and D10105 are the remaining two patches to bring us up to regression test standards. =)
This one is fairly trivial and implements -z, treat \0 as newlines in input files -- i..e, \0 no longer indicates binary, and if we're supposed to be reading (or have read and then written, in case of util.c:495) eol then make sure it's \0 instead of \n.
usr.bin/grep/file.c | ||
---|---|---|
326 ↗ | (On Diff #26649) | It is not, but I didn't know if I should fix the next line while I'm here or not since I wasn't really doing anything with it. I will fix it with an update here shortly. |
usr.bin/grep/util.c | ||
495 ↗ | (On Diff #26649) | So, it depends. If we're supposed to be printing the matched lines, we need to do so faithful to the input file -- i.e., this line, and actually line 491 that I missed (!oflag, but color). Everything else is printing excerpts and should use the standard grep newline separator. |
There are a few style(9) issues noted inline (line length and tabs vs spaces) which I will handle before commit.
usr.bin/grep/file.c | ||
---|---|---|
325 ↗ | (On Diff #27205) | Need to wrap at < 80 cols |
usr.bin/grep/grep.c | ||
112 ↗ | (On Diff #27205) | whitespace |
219 ↗ | (On Diff #27205) | whitespace |
usr.bin/grep/grep.h | ||
119 ↗ | (On Diff #27205) | whitespace |
usr.bin/grep/grep.1 | ||
---|---|---|
33 ↗ | (On Diff #27205) | .Dd needs to be updated when man page content changes |