summaryrefslogtreecommitdiffstats
path: root/usr.bin/grep (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-163-9/+5
| | | | | | | | | 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)
* An article on medium.com highlighted that grepdaniel2015-01-131-3/+3
| | | | | | | | | was available in v4. To quote Ken Thompson, grep appeared "sometime before the 4th edition." ok schwarze@
* 1. They're flags, not counters. Set to one instead of incrementing.tedu2015-01-102-23/+15
| | | | | 2. The G flag is useless and never checked. Remove it. ok millert
* use reallocarray()deraadt2014-12-013-5/+15
|
* Prefer setvbuf() to setlinebuf() for portability; ok deraadt@millert2014-11-261-2/+2
|
* Make option string/struct const (since it is...). I've had thismillert2014-11-261-4/+4
| | | | in my tree for ages.
* Check the mode flag being passed in to mmopen() instead of ignoring it.brad2014-11-081-3/+3
| | | | | | | | Pointed out by LLVM. mmfile.c:51:7: warning: explicitly assigning a variable of type 'char *' to itself [-Wself-assign] ok millert@
* Use errc/warnc to simplify code.guenther2014-05-201-2/+2
| | | | | | Also, in 'ftp', always put the error message last, after the hostname/ipaddr. ok jsing@ krw@ millert@
* unsigned char casts for ctypederaadt2013-11-262-5/+5
| | | | ok krw
* simple prototype repairsderaadt2013-11-121-2/+2
|
* blacklist a select few characters instead of a limited whitelist fortedu2013-05-041-11/+21
| | | | | detecting non-regex patterns. makes the fast grep code more applicable. with some improvements by Jeremie Courreges-Anglas
* remove uesless Pp;jmc2013-01-171-3/+2
|
* Fix exit status when there is an error reading a file.millert2012-12-293-6/+10
| | | | | Reported by Jeramey Crawford, fix adapted from FreeBSD. OK guenther@
* Don't print zero length matches in -o mode. Found by otto@ whomillert2012-12-121-2/+2
| | | | initially proposed a different fix. OK otto@
* use proper eol offset for -o matching; spotted by ajacoutot@; ok millert@otto2012-12-111-2/+2
|
* Fix an integer overflow for very long lines by replacing the datatype of 2 offsets from int to regoff_t.aschrijver2011-07-171-3/+9
| | | | | | | | | | | 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@
* Fix spacingaschrijver2011-07-171-4/+4
| | | | OK otto@
* the matchall magic shortcut requires we set c=1 to print nowtedu2011-07-111-1/+2
| | | | fixes libpqxx build
* add support for -o to only print the match.tedu2011-07-085-33/+57
| | | | reminded this was useful by ajcoutot
* Switch binary file detection from !(isprint() || isspace()) to checkingstsp2011-06-201-20/+14
| | | | | | | 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@
* add -H (opposite of -h) to always print name. ok deraadt millerttedu2011-03-043-12/+21
|
* add an EXIT STATUS section for /usr/bin;jmc2010-09-031-3/+3
|
* Remove the "fast" grep code if SMALL. This has the side effect of breakingtedu2010-07-022-3/+27
| | | | fgrep -w, but oh well. ok deraadt millert
* Do not include mmap support with -DSMALL.nicm2010-07-023-3/+17
| | | | ok millert
* prevent out-of-bounds access with empty pattern (fixes "grep -x ''")eric2010-04-251-2/+2
| | | | ok millert@ krw@
* Fix "grep -e foo -w" crash. The problem lies in 'e' getopt clausejacekm2010-04-201-4/+17
| | | | | | | calling add_pattern, which in turn assumes that the getopt phase has already finished. OK otto@
* make this page read a little better;jmc2010-04-051-4/+4
|
* remove some non-POSIX standard non-GNU defacto standard options, mostlytedu2010-04-054-60/+16
| | | | | 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
* bump the posix reference in STANDARDS to IEEE Std 1003.1-2008, with a fewjmc2009-02-081-3/+3
| | | | updates to follow;
* two globals not needed in NOZ modederaadt2008-10-161-1/+3
|
* Process patterns containing $ end ^ (but not as last or first char)otto2007-10-021-2/+1
| | | | using regcomp() instead of fastcomp(). ok millert@
* use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsgderaadt2007-09-023-5/+16
|
* convert to new .Dd format;jmc2007-05-311-2/+2
|
* - use a consistent text for STANDARDSjmc2007-05-301-2/+2
| | | | - note which options are extensions to POSIX
* - Be explicit on command line checking, instead of relying on patterns,kili2007-02-132-20/+17
| | | | | | | | | | | | | | | | 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@
* fts_read returning NULL and errno set is an error. ok ray@otto2006-12-261-1/+3
|
* Reset the number of lines of tail context left to printjaredy2006-11-171-1/+2
| | | | | | | | | | before processing each file to avoid printing lines intended from the previous file. Reported and fix by Charles Longeau <chl@tuxfamily.org> via tech@. ok otto millert
* Check length before checking index of len - 1.ray2006-11-021-2/+2
| | | | OK moritz@.
* Allow zero-length patterns with -x sojaredy2006-09-262-6/+7
| | | | | | | | | | $ 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
* That should be S_ISREG, dunno why I committed this wrong version;otto2006-09-201-2/+2
| | | | spotted by hshoexer@
* Use S_IS* macros insted of masking with S_IF* flags. The latter mayotto2006-09-191-2/+2
| | | | | have multiple bits set, which lead to surprising results. Spotted by Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@
* Break patterns containing newlines into multiple patterns like POSIX says.otto2006-03-071-3/+15
| | | | | Report by Ralf dot Wildenhues at gmx dot de; testing by jmc@ ok beck@ millert@
* -nv is a valid combination; confirmed by ottojmc2006-03-071-3/+2
|
* delint; remove redundant vars and functions; ok jaredy@otto2006-02-096-56/+9
|
* restore cosmic balance by plugging a mem leak; problem reported byotto2006-02-071-1/+2
| | | | Benjamin Pineau in PR 5008; ok weingart@
* s/-p1003.1-2003/-p1003.1-2004/gjmc2005-06-051-2/+2
|
* - use size_t where appropriate.otto2005-04-251-4/+4
| | | | | - check for <= 0 in gzread; it returns -1 on error. From christos@netbsd; ok millert@
* Make the processing of patterns collected from files specified by -fjaredy2005-04-031-3/+21
| | | | | | | delayed so options that affect pattern-building (such as -w) can be applied evenly to all such patterns. ok and help otto, ok millert
* Protect begin and end of word markers added to the pattern whenotto2005-04-032-8/+18
| | | | | | | 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@
* Due to a braindead zlib, the test for seekability of a gzstream usingotto2005-02-072-4/+13
| | | | | | gzseek(f, 0L, SEEK_CUR) does not work as expected. Instead test the underlying stream and remember that. This repairs echo foo | gzip | zgrep foo. Problem spotted by Han Boetes in PR 4089; ok millert@