freebsd-dev/contrib/netbsd-tests/usr.bin
Ed Maste 6d635d3b32 bsdgrep: Correct per-line line metadata printing
Metadata printing with -b, -H, or -n flags suffered from a few flaws:

1) -b/offset printing was broken when used in conjunction with -o

2) With -o, bsdgrep did not print metadata for every match/line, just
   the first match of a line

3) There were no tests for this

Address these issues by outputting this data per-match if the -o flag is
specified, and prior to outputting any matches if -o but not --color,
since --color alone will not generate a new line of output for every
iteration over the matches.

To correct -b output, fudge the line offset as we're printing matches.

While here, make sure we're using grep_printline in -A context.  Context
printing should *never* look at the parsing context, just the line.

The tests included do not pass with gnugrep in base due to it exhibiting
similar quirky behavior that bsdgrep previously exhibited.

Submitted by:	Kyle Evans <kevans91@ksu.edu>
Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D10580
2017-05-20 11:20:03 +00:00
..
awk
basename
bzip2
cc Checkpoint initial integration work 2016-08-12 08:50:05 +00:00
cmp
config Upgrade NetBSD tests to 01.11.2017_23.20 snapshot 2017-01-13 03:33:57 +00:00
cut
diff
dirname Remove expected failure for :basic (effectively reverting r305007, r305031) 2016-09-19 06:39:08 +00:00
find
gdb Checkpoint initial integration work 2016-08-12 08:50:05 +00:00
grep bsdgrep: Correct per-line line metadata printing 2017-05-20 11:20:03 +00:00
gzip
id
infocmp
jot
ld Checkpoint initial integration work 2016-08-12 08:50:05 +00:00
m4
make Checkpoint initial integration work 2016-08-12 08:50:05 +00:00
mixerctl Merge content currently under test from ^/vendor/NetBSD/tests/dist/@r312123 2017-01-14 06:49:17 +00:00
mkdep
nbperf
netpgpverify Upgrade NetBSD tests to 01.11.2017_23.20 snapshot 2017-01-13 03:33:57 +00:00
pr
rump_server
sdiff
sed Checkpoint initial integration work 2016-08-12 08:50:05 +00:00
shmif_dumpbus
sort Checkpoint initial integration work 2016-08-12 08:50:05 +00:00
tmux
tr
unifdef
uniq Merge content currently under test from ^/vendor/NetBSD/tests/dist/@r312123 2017-01-14 06:49:17 +00:00
vmstat
xlint/lint1 Upgrade NetBSD tests to 01.11.2017_23.20 snapshot 2017-01-13 03:33:57 +00:00