Module Name:    src
Committed By:   martin
Date:           Thu Jun 20 10:43:49 UTC 2024

Modified Files:
        src/external/bsd/tre/dist/src [netbsd-10]: agrep.c

Log Message:
Pull up following revision(s) (requested by andvar in ticket #699):

        external/bsd/tre/dist/src/agrep.c: revision 1.5
        external/bsd/tre/dist/src/agrep.c: revision 1.6

agrep(1): rewrite binary check introduced with recursive search on rev 1.3 to
match more closely grep(1) implementation. Instead of opening and scanning
full file every time, check for the \0 symbol once the file buffer is filled up
for the first time.

Patch fixes stdin, adds binary check for it as well, and works more efficiently
(at the cost of not scanning the full file).
Also original implementation forgot to add break if binary file is detected,
causing duplicate binary matches in the output result.

Due to full file scans on each match instead of once for the specific file,
scans may have been considerably slow.

Fixes PR bin/53513

Thanks for the help from mlelstv and dh in reviewing and finalizing the patch.
agrep(1): remove duplicated and obsolete imports.
dirent import is the only one which stays in the odd location.

Part of PR bin/53513.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.6.1 src/external/bsd/tre/dist/src/agrep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to