summaryrefslogtreecommitdiff
path: root/usr.bin/grep
AgeCommit message (Collapse)Author
2004-05-07Make grep -w behave the same for the fastcomp and the regex case,Otto Moerbeek
by teaching fastcomp what word boundaries are according to regex. ok millert@
2004-05-07Add a new past path for fgrep that is just a simplified version ofTodd C. Miller
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@
2004-05-06Don't fseek() on stdin if it is a terminal. It does not fail, butOtto Moerbeek
what's more more important, it does not work either. ok millert@ tedu@
2004-05-06Treat ^H as non-binary. OK hshoexer@, brad@ and deraadt@Todd C. Miller
2004-04-17-w uses [[:<:]] and [[:>:]], not \< and \>,Jason McIntyre
and it's documented in re_format(7), not ex(1); from jared yanovich; ok beck@
2004-04-03remove unnecessary .Sm macros (oops, this is my fault it everJason McIntyre
made it into the tree);
2004-04-02Document --line-bufferedOtto Moerbeek
ok jmc@
2004-04-02Implement --line-bufferedOtto Moerbeek
ok millert@ tedu@
2004-03-15simpler special character list. provoked by Patrick Latifi ok jmc@Ted Unangst
2004-02-04Fix anchors (^ or $) in -w mode broken by the last commit's -w overhaul.Todd C. Miller
With this change we pass the updated regress. Tested and OK by ho@
2004-01-26dataLen should be size_t to match l->len; ok otto@ tedu@Todd C. Miller
2004-01-25Previously, in -w mode, for each match on a line grep would checkTodd C. Miller
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@.
2004-01-19-b reports offsets in bytes.Otto Moerbeek
ok millert@
2004-01-19Use off_t for file sizes, and don't forget to print a ':' when usingOtto Moerbeek
the -b option. ok millert@
2004-01-18Unbreak *grep -w -l. ok millert@Otto Moerbeek
2004-01-18make sure ln.len gets initialized. Okay millert@Marc Espie
2003-12-29fix zgrep failure when the uncompressed file begins with a newlineCan Erkin Acar
also, search from the beginning if a stream or compressed file is identified as 'binary'. ok millert@, reported by tedu@, tested by jose@
2003-12-11Sync usage() with SYNOPSIS in grep(1).Ryan Thomas McBride
ok deraadt@ jmc@
2003-12-11Document use of [pattern] without -e, give example of -v with multipleRyan Thomas McBride
patterns. ok deraadt@ jmc@
2003-12-06Unbreak grepping for some patterns containing multiple dots. Fixes PR 3597.Otto Moerbeek
ok deraadt@ millert@
2003-10-28prototype declared static, but function was not. add static to function.Anil Madhavapeddy
millert@ otto@ ok
2003-10-20typos from Jared Yanovich;Jason McIntyre
2003-09-27Correct wording on -C option.Ryan Thomas McBride
ok jmc@
2003-09-18make this test look for spaces as well, to match other casesBob Beck
ok fgs@ ok deraadt@
2003-09-09mmap returns MAP_FAILED on failure. fixes hugh@'s crash. ok deraadt@Ted Unangst
2003-09-07Fix "grep -number" support for multi-digit numbers. At issue isTodd C. Miller
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@
2003-09-07extend ascii test for more accuracy. ok deraadt@ pb@Ted Unangst
2003-08-20Add curly braces {} to the list of special characters in egrep mode.Todd C. Miller
From Piotr Domagalski, closes PR 3405
2003-08-11typo, pr3396 from piotr domagalskiTed Unangst
2003-07-20After some discussion on icb it seems a do {} while is what we wantTodd C. Miller
after all since there's no need to check an invariant the first time through. I've fixed the loop invariants (we need to take special care with the "j == fg->patternLen" case) and hopefully made things a tad bit clearer. tedu@ OK
2003-07-20Close PR 3358 by changing the loop from do {} while -> for; tdeval@ OKTodd C. Miller
2003-07-17Make it clear what -C does w/o having to read the description of -A/-B.Todd C. Miller
Lack of clarity pointed out by Sam Smith, different fix suggested by jmc@
2003-07-16When reallocing pattern, use sizeof(*pattern) not sizeof(int).Todd C. Miller
Fixes a problem on sparc64 where sizeof(int) != sizeof(pointer). Based on a patch from Brian Poole; tedu@ OK
2003-07-15- .Ql Li -> .Ql (Ql already provides literal font)Jason McIntyre
- remove a .Pp
2003-07-14range-check numeric arguments (-num, -A num, -B num)Todd C. Miller
2003-07-10restore grep -v semantics, print lines that don't match any (mismatch all)Daniel Hartmeier
patterns. ok tedu@, millert@
2003-07-10grep should exit(2) on error, not exit(1) (1 means no matches found).Todd C. Miller
deraadt@ OK
2003-07-10knfTheo de Raadt
2003-07-10Fix parsing of -NUMBER. We now do things a digit at a time andTodd C. Miller
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.
2003-07-06no need to redefine strlcpy here; millert@ okAnil Madhavapeddy
2003-07-02protosTheo de Raadt
2003-07-01Fix bounds check in the fast grep code that caused an incorrectTodd C. Miller
array access (and a core dump on sparc64 at least). Noticed by sturm@ and pvalchev@. Fix tested an OK by pvalchev@.
2003-06-25o remove useless cast to int from gzread() callTodd C. Miller
o maxPatternLen should be size_t since that's what it is compared against o remove useless casts of NULL to various pointer types
2003-06-25Function prototypes that take no args should have (void) as the parameter.Todd C. Miller
2003-06-25-pedantic is not useful in a C99 world so kill it. OK deraadt@Todd C. Miller
2003-06-25knfTheo de Raadt
2003-06-25backwards args to gzseekTed Unangst
2003-06-24Make 'grep -w' work; OK tedu@Todd C. Miller
2003-06-24actually do fgrep. -G -F and -E are now mutally exclusive, and overrideTed Unangst
the program name as expected. ok millert@
2003-06-24tweak boolean test to be clearTed Unangst