improvements:
- improve statuscode behaviour
- don't exit if a file in a series fails. exit 2 if an error occured
in a file series. don't exit if there is a read error (like: grep
input file is a directory).
- use agetline instead of agets().
with the simple test: time seq 1 100000000 | grep 'a'
its 12 seconds (from 24 seconds) on my machine.
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
This reverts commit d9a098ae6bc07188cbaefcd188e5911dec41815d.
Conflicts:
grep.c
Hiltjo Posthuma <hiltjo@codemadness.org> said:
(Re)compiling the regex for each line doesn't make sense (imho) and
slows it down a lot.
A simple test:
time seq 1 100000000 | grep 'a'
sbase grep (before patch):
0m22.21s real 0m0.00s user 0m0.00s system
sbase grep (after patch):
2m16.28s real 0m0.00s user 0m0.00s system
coreutils grep:
0m1.15s real 0m0.00s user 0m0.00s system
So the patch should be reverted I think.