feat(grep): treat - operand as standard input (#331)
`grep PATTERN -` failed with "grep: -: No such file or directory" instead of reading stdin. GNU treats `-` as a FILE operand naming standard input, labelled `(standard input)` wherever a file name would appear. - `-` reads stdin and is labelled `(standard input)` in the multi-file prefix and in -l/-L/-c output; a lone `-` gets no prefix, and -h suppresses it like any other file name. - stdin is a stream: repeated `-` operands see it drained by the first, so `grep -c pat - -` prints `(standard input):N` then `(standard input):0`. - `-` bypasses glob expansion, -r recursion and --include/--exclude, which all filter on a file name stdin does not have. Under -r the file-name prefix is now forced only when a real path is searched, so `grep -r pat -` prints bare lines like GNU. - Empty stdin is a valid empty stream (exit 1, `-c` prints 0); absent stdin reads as empty, matching `cat -`. Unskips 4 busybox spec tests and corrects the reason on 2 that stay skipped for unrelated causes (spec-runner path rewriting, missing -s). All expectations verified against GNU grep 3.12; comparison fixtures are recorded from it and locked. Signed-off-by: Lars Trieloff <lars@trieloff.net>
L
Lars Trieloff committed
66802470837cfac3a58a09e00d37b2070387ba7b
Parent: 4f9bdec
Committed by GitHub <noreply@github.com>
on 8/6/2026, 2:04:17 AM