freebsd-dev/contrib
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
..
amd Fix mips 32-bit buildworld. 2016-11-14 00:33:03 +00:00
apr
apr-util
atf Skip tests depending on coredumps if coredumps are disabled via kern.coredump. 2017-05-16 18:42:44 +00:00
binutils Fix parsing of 'vmov Q<n>.F32,Q<n>.F32' instruction. 2017-05-10 05:07:41 +00:00
blacklist Merge latest version of blacklist sources from NetBSD (@ 20170503) 2017-05-04 19:07:37 +00:00
bmake Merge bmake-20170510 2017-05-10 22:45:05 +00:00
bsnmp Hide struct inpcb, struct tcpcb from the userland. 2017-03-21 06:39:49 +00:00
byacc Apply r274475's to expr.oxout.tab.c to fix the test on FreeBSD 2017-02-07 18:37:46 +00:00
bzip2 bzip2 does not exit after showing license as requested with --version 2016-12-28 18:04:18 +00:00
com_err
compiler-rt Add an implementation of __ffssi2() derived from __ffsdi2(). 2017-04-05 02:40:53 +00:00
cortex-strings Fix the asm on the memchr and strchr functions. 2016-09-19 14:36:16 +00:00
dialog
diff
dma Import dma snapshot from git 2017-02-10 2017-03-01 21:42:22 +00:00
dtc Merge from vendor branch importing dtc 1.4.3 2017-03-10 17:36:05 +00:00
ee
elftoolchain revert r308465: c++filt: flush output after newline 2017-05-01 01:56:11 +00:00
expat MFV r302260: expat 2.2.0 2016-07-01 05:48:45 +00:00
file MFV r308392: file 5.29. 2016-11-07 15:54:47 +00:00
flex
gcc Fix _Unwind_Backtrace symbol version for ARM. 2017-05-09 12:14:00 +00:00
gcclibs Define libcpp's HAVE_DESIGNATED_INITIALIZERS in a defined and portable 2016-09-05 18:02:37 +00:00
gdb Fix KGDB backtrace on ARM 2016-04-20 17:58:13 +00:00
gdtoa
gperf
groff Perl is not available in base fix scripts depending on it to use 2016-12-10 12:02:32 +00:00
hyperv/tools hyperv/kvp: Fix pool direcrory and file permission 2017-05-04 01:46:04 +00:00
ipfilter Implement ippool command line IPv6 address parse support (for the -i 2017-05-16 02:48:46 +00:00
jemalloc Update jemalloc to 4.5.0. 2017-03-02 01:14:48 +00:00
ldns
ldns-host Initialize first_serial to 0 in dozonetransfer(..) to fix -Wuninitialized 2016-07-14 06:10:16 +00:00
less MFV r317581: less v491. 2017-05-05 14:33:39 +00:00
libarchive cpio/tests/test_option_lz4: fix a use after free in the failure case 2017-05-11 08:22:01 +00:00
libbegemot
libc-pwcache
libc-vis strvis(3): Avoid internal state of multibyte functions being tainted. 2016-12-06 17:05:02 +00:00
libc++ Pull in r302362 from upstream libc++ trunk (by me): 2017-05-06 21:43:55 +00:00
libcxxrt Import libcxxrt master 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92. 2017-03-25 13:17:48 +00:00
libdivsufsort Change bsdiff to use divsufsort suffix sort library instead of qsufsort, 2016-07-25 03:58:19 +00:00
libexecinfo Remove usage of _WITH_DPRINTF 2016-07-30 01:16:06 +00:00
libgnuregex Back out non-collating [a-z] ranges. 2016-07-14 09:45:07 +00:00
libpcap MFV r316124: Fix build when WITHOUT_INET6. 2017-03-29 03:36:26 +00:00
libreadline
libstdc++ libstdc++: fix symbol version script for LLD 2017-04-19 19:06:47 +00:00
libucl Import libucl 20170219 2017-02-19 17:37:16 +00:00
libxo Import libxo-0.7.2; add xo_options.7. 2017-05-16 18:46:56 +00:00
llvm Pull in r302183 from upstream llvm trunk (by Krzysztof Parzyszek): 2017-05-04 21:40:16 +00:00
mdocml Import mandoc 1.4.1rc2 2017-02-19 17:46:37 +00:00
mknod
mtree Use type-independent formats for printing nlink_t and ino_t. 2017-01-06 16:59:33 +00:00
ncurses In ncurses baudrate definitions, avoid warnings about implicit 2016-08-27 20:33:19 +00:00
netbsd-tests bsdgrep: Correct per-line line metadata printing 2017-05-20 11:20:03 +00:00
netcat Merge projects/ipsec into head/. 2017-02-06 08:49:57 +00:00
ngatm Fix the following clang 4.0.0 warning in ngatm's snmp_atm.c: 2017-01-07 15:57:12 +00:00
ntp MFV r315791: ntp 4.2.8p10. 2017-03-23 22:06:06 +00:00
nvi
ofed cxgbe/iw_cxgbe: Report accurate page_size_cap in ib_query_device. 2017-04-14 19:18:50 +00:00
one-true-awk MFV r315425: 2017-03-16 21:32:05 +00:00
openbsm Merge OpenBSM 1.2-alpha5 from vendor branch to FreeBSD -CURRENT: 2017-03-26 21:14:49 +00:00
openpam Upgrade to OpenPAM Resedacea. 2017-05-05 13:31:25 +00:00
openresolv MFV r312970: 2017-01-30 16:32:53 +00:00
opie
pam_modules/pam_passwdqc
pf Rename getline with get_line to avoid collision with getline(3) 2016-05-10 11:09:26 +00:00
pjdfstest Better handle filesystems mounted with -o noexec 2016-03-12 19:41:38 +00:00
pnpinfo
sendmail Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
serf
smbfs Add #include <string.h> to mute warning from clang/gcc about implicitly 2016-02-01 07:09:08 +00:00
sqlite3 MFV r304732. 2016-08-24 12:32:24 +00:00
subversion Update from subversion 1.9.4 to 1.9.5. 2016-12-01 07:50:44 +00:00
tcp_wrappers tcp_wrappers: Sprinkle some bounds-checked string copying 2017-04-14 00:45:09 +00:00
tcpdump Cherry-pick 5d3c5151c2b885aab36627bafb8539238da27b2d, it fixes use after free 2017-04-25 15:56:46 +00:00
tcsh MFV r315950: 2017-03-25 14:14:11 +00:00
telnet When telnetd(8) composes argument list for login(1), an unexpected sequence 2016-12-06 18:50:22 +00:00
tnftp Fix warnings in tnftp about invalid constant conversions, e.g.: 2016-08-30 20:24:50 +00:00
top Provide proper contemporary function prototypes for many of the functions 2017-03-26 17:22:44 +00:00
traceroute Fix userland tools that don't check the format of routing socket 2017-04-16 19:17:10 +00:00
tzcode Renumber copyright clause 4 2017-02-28 23:42:47 +00:00
tzdata Import tzdata 2017b 2017-03-27 21:00:49 +00:00
unbound Upgrade to Unbound 1.5.10. 2016-09-29 18:24:29 +00:00
unvis
vis
wpa
xz MFV r311477: xz 5.2.3. 2017-01-06 07:54:53 +00:00
zlib MFV r312333: zlib 1.2.11. 2017-01-17 05:55:47 +00:00
zstd Import Zstandard 1.2.0 2017-05-06 10:26:40 +00:00