summaryrefslogtreecommitdiff
path: root/usr.bin/grep/grep.c
AgeCommit message (Collapse)Author
2005-04-03Make the processing of patterns collected from files specified by -fJared Yanovich
delayed so options that affect pattern-building (such as -w) can be applied evenly to all such patterns. ok and help otto, ok millert
2005-04-03Protect begin and end of word markers added to the pattern whenOtto Moerbeek
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@
2004-10-03Remove block based mmap optimization. There are newline problemsOtto Moerbeek
(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@
2004-09-28various fixes to make this page a bit clearer and hopefully a bitJason McIntyre
more helpful; this includes some ideas/fixes from otto and jared;
2004-08-05spacingTheo de Raadt
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-04-02Implement --line-bufferedOtto Moerbeek
ok millert@ tedu@
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-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@.
2003-12-11Sync usage() with SYNOPSIS in grep(1).Ryan Thomas McBride
ok deraadt@ jmc@
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-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-14range-check numeric arguments (-num, -A num, -B num)Todd C. Miller
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-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-24actually do fgrep. -G -F and -E are now mutally exclusive, and overrideTed Unangst
the program name as expected. ok millert@
2003-06-23strncpy -> memcpy per deraadt suggestion.Ted Unangst
also add a note why we can't use strlcpy.
2003-06-23go back to using strncpy. for long patterns, strlcpy reads too muchTed Unangst
of a potentially nontermined src.
2003-06-23faster grep for simple patterns. derived from a patch by sean farley.Ted Unangst
this makes searching for constant strings much faster by avoiding regex. ok deraadt@
2003-06-23minor tweaksTheo de Raadt
2003-06-23use strlcpy, not strncpy. ok deraadt@ millert@Ted Unangst
2003-06-23spellingTed Unangst
2003-06-23better detetection/handling of binary files.Ted Unangst
make -a do the right thing, doc and implement -U, -I. add --help and --mmap for compatibility. some other minor fixes. some from NetBSD. ok deraadt@
2003-06-22use __progname instead of progname. ok deraadtTed Unangst
2003-06-22fix usageTheo de Raadt
2003-06-22proper $OpenBSD$Theo de Raadt
2003-06-22-DNOZ flag to be used by install media for removing z*grep support, ifTheo de Raadt
needed. (and knf)
2003-06-22support z{e,f}grepTheo de Raadt
2003-06-22freegrep 0.16Theo de Raadt
2003-02-16Fix format string bug. I believe this grep is currently not used (inChad Loder
favor of the GNU version), but it gets fixed anyways. ok mickey@
2001-09-21complete grep clone by harding@motd.ca; everything is there, but it isTheo de Raadt
slow because libc regexp is slow. Anyone out there have the balls to sit down and optimize libc regexp?