Age | Commit message (Collapse) | Author |
|
Looks nicer and matches the output of GNU grep.
ok millert@ deraadt@ visa@ miod@
|
|
OK visa deraadt
|
|
Saner default behavior that matches GNU grep. Diff from miod@, support
from espie@, ok visa@ millert@
|
|
|
|
|
|
add --label option to prefix the output instead of filename.
allow using - to mean stdin.
ok deraadt
|
|
the documented -m. As a rule, we only document long options when
users can't avoid them because they lack a short version.
As suggested by tedu@, as an exception, leave --context documented
because -C is awkward in so far as it takes an optional option
argument, which is fragile and error-prone and hence generally
discouraged, including by POSIX.
Two years ago, kettenis@, deraadt@, and tedu@ all agreed that this
is what should be done, and jmc@ was happy to accept the direction,
but somehow everybody forgot to commit.
|
|
originally from chrisz
|
|
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@.
|
|
from Michael Santos
|
|
set NOTBOL so that anchored patterns don't match.
from a patch by Daniël de Kok in freebsd bug 201650
ok martijn
|
|
we are looking for all matches in a line; ok natano@ miilert@ tedu@
|
|
correctly - logically complete that now by removing MLINKS from base;
authors need only to ensure there is an entry in NAME for any function/
util being added. MLINKS will still work, and remain for perl to ease
upgrades;
ok nicm (curses) bcook (ssl)
ok schwarze, who provided a lot of feedback and assistance
ok tb natano jung
|
|
ok millert@
|
|
the length parameter. The return value of grep_cmp() is only used
in a boolean context so make it return bool instead of the index.
OK mmcc@
|
|
64 bits.
ok kettenis@
|
|
overflow on huge inputs. ok millert@, 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@
|
|
Not bugs in short-lived commands that call exit() -> _exit() immediately,
but for idempotency.
Originally found in ls(1) by Valgrind. Changes for other commands are
from deraadt@. Reviewed by me, tested in snapshots.
OK deraadt@
|
|
OK schwarze@ ian@
|
|
for us.
|
|
|
|
obsolete SIZE_T_MAX. OK miod@ beck@
|
|
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)
|
|
was available in v4.
To quote Ken Thompson, grep appeared "sometime
before the 4th edition."
ok schwarze@
|
|
2. The G flag is useless and never checked. Remove it.
ok millert
|
|
|
|
|
|
in my tree for ages.
|
|
Pointed out by LLVM.
mmfile.c:51:7: warning: explicitly assigning a variable of type 'char *' to itself [-Wself-assign]
ok millert@
|
|
Also, in 'ftp', always put the error message last, after the hostname/ipaddr.
ok jsing@ krw@ millert@
|
|
ok krw
|
|
|
|
detecting non-regex patterns. makes the fast grep code more applicable.
with some improvements by Jeremie Courreges-Anglas
|
|
|
|
Reported by Jeramey Crawford, fix adapted from FreeBSD.
OK guenther@
|
|
initially proposed a different fix. OK otto@
|
|
|
|
offsets from int to regoff_t.
Bail if the given size_t line length doesn't fit into the new regoff_t.
"I don't think you will ever be able to get a string longer than
SSIZE_MAX into memory, but that looks good." tedu@
"Agreed" otto@
regoff_t suggested by otto@
|
|
OK otto@
|
|
fixes libpqxx build
|
|
reminded this was useful by ajcoutot
|
|
for embedded NULs. Matches GNU and FreeBSD grep, and avoids problems with
e.g. latin1-encoded files being treated as binary in the UTF-8 locale once
grep calls setlocale() (which it does not, yet).
OK millert@ tedu@
|