| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
better example for other code to follow. in the common case, grep uses
mmap anyway (so no functional change). despite fgetln doing sneaky things
with stdio internals, preliminary analysis by lauri suggests this may
actually reduce the number of allocations.
from Lauri Tirkkonen.
|
|
|
|
|
| |
cleaner, but should be no functional change.
from Lauri Tirkkonen
|
|
|
|
|
|
| |
- list long options with short, where they have an equivalent
- sync usage()
- minor tweaks
|
|
|
|
|
|
|
|
| |
grep -m num stops after a maximum of num matches are found.
We support -m0 to match GNU behaviour, but we do not allow negative
numbers.
Manpage help from jmc@, OK deraadt@.
|
|
|
|
| |
OK millert@ deraadt@
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
computation, and outputs result to stdout. (note: in the tame model,
malloc is implicit because stdio needs it, and mmap is implicit since
malloc needs it; libz is satisfied by this environment also).
this tame change consists of 1 line, setting "stdio rpath" before
getopt. this protection is fairly strict. grep could be improved
further by computing a wpathlist based on argv, keeping -R in mind.
feel free to take a shot at it.
grep was an early target of capsicum also. know anyone running capsicum grep?
ok doug
|
|
|
|
|
|
| |
this provides better error messages.
ok deraadt@ guenther@
|
|
|
|
| |
OK schwarze@ ian@
|
|
|
|
| |
for us.
|
|
|
|
|
| |
2. The G flag is useless and never checked. Remove it.
ok millert
|
| |
|
| |
|
|
|
|
| |
in my tree for ages.
|
|
|
|
|
| |
Reported by Jeramey Crawford, fix adapted from FreeBSD.
OK guenther@
|
|
|
|
| |
reminded this was useful by ajcoutot
|
| |
|
|
|
|
| |
fgrep -w, but oh well. ok deraadt millert
|
|
|
|
|
|
|
| |
calling add_pattern, which in turn assumes that the getopt phase
has already finished.
OK otto@
|
|
|
|
|
| |
relating to symlinks that you can get with find. And a bonus fts flag fix.
With a small tweak by guenther. ok deraadt guenther jmc millert nicm
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
which may be NULL (e.g. -e '').
- let add_pattern() decide how to deal with empty patterns, don't do
magic in read_patterns().
This unbreaks stuff like grep -e '', and makes grep -f <file> more
POSIX compliant. Semantics for grep -f /dev/null (or any other empty
file) may be questionable, but this case isn't specified by POSIX,
and matching nothing at all seems to be sane.
Thanks to otto@, who mentioned potential problems related to the
-x option with the first patch i sent.
ok jaredy@ (some time ago), otto@, millert@
|
|
|
|
| |
OK moritz@.
|
|
|
|
|
|
|
|
|
|
| |
$ grep -x ""
matches empty lines as reported on misc@ by
Martin Marusak <marusak@fhpv.unipo.sk>.
Initial diff by otto@ with tweaks by me.
ok otto
|
|
|
|
|
| |
Report by Ralf dot Wildenhues at gmx dot de;
testing by jmc@ ok beck@ millert@
|
| |
|
|
|
|
|
|
|
| |
delayed so options that affect pattern-building (such as -w) can be
applied evenly to all such patterns.
ok and help otto, ok millert
|
|
|
|
|
|
|
| |
using the -w option with parentheses, to avoid operators in the
expressions binding to the markers. Compare [[:<:]]foo|bar[[:>:]]
and [[:<:]](foo|bar)[[:>:]]. Problem spotted by aaron@; ok millert@
aaron@ jaredy@
|
|
|
|
|
|
|
|
|
| |
(PR 3940, 3941) which can be fixed, but if a match starts at the
end of a block and continues into the next block, no match will be
found. Measurements by millert@ showed that the improvements of
this optimization are non-measurable anyway. Diff from Alexander Taler.
ok millert@
|
|
|
|
|
|
| |
more helpful;
this includes some ideas/fixes from otto and jared;
|
| |
|
|
|
|
|
|
| |
fastcomp. This makes fgrep faster and fixes the -w flag w/ fgrep.
Also remove free_patterns() since calling free right before exit
is silly. Problem noticed by espie@
|
|
|
|
| |
ok millert@ tedu@
|
|
|
|
| |
With this change we pass the updated regress. Tested and OK by ho@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to see if the match was on a word boundary. However, this missed
lines where the first match was not on a word boundary but a
subsequent match was. Problem originally spotted by miod@
We fix this by using the [[:<:]] and [[:>:]] character classes for
the slow path and by checking the word boundaries in grep_search()
for the fast path instead of doing the checks after running
regexec() or grep_search().
With this change, grep passes the new regress tests 15 and 16.
problem originally spotted by espie@.
|
|
|
|
| |
ok deraadt@ jmc@
|
|
|
|
|
|
| |
the fact that optind refers to the *next* argument to be consumed
by getopt(), not the current one. This means we have to keep track
of when we are working with a new argv entry by hand. OK hugh@
|
|
|
|
|
| |
Fixes a problem on sparc64 where sizeof(int) != sizeof(pointer).
Based on a patch from Brian Poole; tedu@ OK
|
| |
|
|
|
|
| |
deraadt@ OK
|
| |
|
|
|
|
|
| |
keep track of what the last char from getopt was as well as the
previous value of optind so we know when a new number has started.
|
|
|
|
|
| |
o maxPatternLen should be size_t since that's what it is compared against
o remove useless casts of NULL to various pointer types
|
|
|
|
| |
the program name as expected. ok millert@
|
|
|
|
| |
also add a note why we can't use strlcpy.
|
|
|
|
| |
of a potentially nontermined src.
|
|
|
|
|
| |
this makes searching for constant strings much faster by avoiding regex.
ok deraadt@
|
| |
|
| |
|
| |
|