41 Commits
Author SHA1 Message Date
SichenLiang 01fb6c3abc grep: handle malformed color environment values (#139) 2026-10-13 23:20:17 +02:00
André VelásquezandLeonard Hecker b68f81cd32 grep: adds lazy buffer ring allocation (#140)
Co-authored-by: Leonard Hecker <leonard@hecker.io>
2026-10-12 14:42:32 +02:00
Sichen 21c51bdb13 grep: share colored file-name prefix output
The count path has been r repeated the same file-name and separator
coloring used by `write_prefix`. Move that part into a small helper and
call it from both places.
2026-10-10 15:57:59 +02:00
Sichen c96d7f844b grep: color prefixes in count output
When `-c` prints a file name, use the `fn` color for the name and `se`
for its separator. Leave the count itself, and a NUL separator if used,
uncolored.
2026-10-10 15:57:59 +02:00
Sichen 5d43092040 grep: fix default and automatic color handling
Treats an omitted color option as `never`. For automatic color, also
require `TERM` to be set on Unix and not equal to `dumb`.
An unset `TERM` does not disable color on Windows, but `TERM=dumb`
still do.
2026-10-10 15:57:59 +02:00
SichenLiang 381695b137 grep: report file errors with -q (#128) 2026-10-01 18:33:49 +02:00
a2bb0c6ecb grep: expand bundled numeric context options (#76)
* grep: expand bundled numeric context options

* Simplify and fix expand_num_shorthand

---------

Co-authored-by: ColumbusLabs <287001685+ColumbusLabs@users.noreply.github.com>
Co-authored-by: Leonard Hecker <leonard@hecker.io>
2026-09-12 22:23:12 +02:00
Sylvestre Ledru 7f316abd0d grep: exit 2 when a -f or --exclude-from file cannot be read (#102)
* grep: exit 2 when a -f or --exclude-from file cannot be read

* grep: make the unreadable pattern file test reliable and portable
2026-08-09 01:45:58 +02:00
Sylvestre Ledru f88244c5f4 grep: reject misspelled character classes like [:space:] (#100) 2026-08-09 00:46:08 +02:00
Sylvestre Ledru 54a846c353 grep: rewind seekable stdin when -m stops the search early (#101) 2026-08-09 00:41:06 +02:00
dc3cddf2de grep: avoid multi-character case folds (#54)
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Co-authored-by: Leonard Hecker <leonard@hecker.io>
2026-08-08 22:56:08 +02:00
Sylvestre Ledru 35b6dc64ac matcher: report reversed bracket ranges as GNU's "Invalid range end" (#71) 2026-07-20 19:18:24 +02:00
Froloket64 f578eb2b5d grep: make '-o' override context arguments (#72)
* grep: make '-o' override context arguments

* test: cover -o with context arguments
2026-07-20 19:16:21 +02:00
Sylvestre Ledru 0b29ccfcd2 grep: support GREP_COLORS mt and warn on deprecated GREP_COLOR (#70) 2026-07-20 16:59:28 +02:00
WondrandSylvestre Ledru aae3d4f2ce grep: short-circuit max-count zero (#46)
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2026-06-28 10:53:53 +02:00
Wondr 9cfca221d2 grep: short-circuit inverted empty patterns (#43) 2026-06-28 10:23:42 +02:00
Sylvestre Ledru 191085c9f0 grep: -q match yields exit 0 even after a file error (#11)
GNU grep documents that with -q the exit status is 0 as soon as a line
is selected, even if an error (such as a missing file) occurred. uu_grep
let had_error take precedence, so 'grep -q PAT missing -' returned 2
instead of 0 when stdin matched. Give quiet+match priority in finish();
without -q, or with -q and no match, a file error still yields exit 2.
Fixes the GNU testsuite 'status' test.
2026-06-27 17:03:33 +02:00
Wondr 1dfec4a073 grep: warn on leading ERE repeat operators (#48) 2026-06-27 17:01:37 +02:00
Wondr a6f874b7e6 grep: reject conflicting matcher flags (#47) 2026-06-27 17:01:33 +02:00
Wondr 42a9c12d1b grep: avoid separators for adjacent context groups (#42) 2026-06-27 17:01:29 +02:00
oech3 68caea0a57 remove eprintln! to avoid SIGABRT (#62) 2026-06-12 18:06:53 +02:00
Wondr e925ff4ac8 grep: honor GNU buffer anchors (#56) 2026-06-05 17:33:23 +02:00
Leonard Hecker 265a562c26 grep: Simplify session_finalize 2026-06-05 17:04:29 +02:00
Wondr 55a7b0180b grep: suppress EOF output in quiet mode (#41) 2026-06-05 16:48:36 +02:00
Wondr d556159952 grep: let dot match newline in null-data mode (#45) 2026-06-05 16:25:04 +02:00