summaryrefslogtreecommitdiffstats
path: root/usr.bin/grep/grep.c
Commit message (Collapse)AuthorAgeFilesLines
* - Avoid unnecessary strdup()gabor2013-01-201-2/+2
| | | | | Submitted by: ache MFC after: 5 days
* - Fix handling of the case when multiple patterns are specified in a singlegabor2013-01-051-2/+12
| | | | | | | | command line argument, separated by newlines PR: bin/173673 Submitted by: ache MFC after: 1 week
* Make bsdgrep behave as gnugrep and as documented: -m should only stopeadler2012-12-201-1/+2
| | | | | | | | | reading the specific file, not any file. Tested by: frogs (irc) Reviewed by: gabor Approved by: cperciva (implicit) MFC after: 1 week
* More -Wmissing-variable-declarations fixes.ed2012-10-191-3/+4
| | | | | | | | | | | | | | | | In addition to adding `static' where possible: - bin/date: Move `retval' into extern.h to make it visible to date.c. - bin/ed: Move globally used variables into ed.h. - sbin/camcontrol: Move `verbose' into camcontrol.h and fix shadow warnings. - usr.bin/calendar: Remove unneeded variables. - usr.bin/chat: Make `line' local instead of global. - usr.bin/elfdump: Comment out unneeded function. - usr.bin/rlogin: Use _Noreturn instead of __dead2. - usr.bin/tset: Pull `Ospeed' into extern.h. - usr.sbin/mfiutil: Put global variables in mfiutil.h. - usr.sbin/pkg: Remove unused `os_corres'. - usr.sbin/quotaon, usr.sbin/repquota: Remove unused `qfname'.
* Remove duplicate line from usageeadler2012-01-151-1/+0
| | | | | | | PR: bin/164139 Submitted by: Yuri Pankov <yuri.pankov@gmail.com> Approved by: nwhitehorn MFC after: 3 days
* Add missing "static const" to long options table.ed2011-12-101-1/+1
| | | | | This table is only used in this C file and passed to getopt_long(), so we can safely add static and const to it.
* - Match GNU behavior of exit codegabor2011-12-071-2/+2
| | | | | | | | - Rename variable that has a different meaning now PR: bin/162930 Submitted by: Jan Beich <jbeich@tormail.net> MFC after: 1 week
* - Use getprogname() instead of __prognamegabor2011-10-111-6/+9
| | | | | | | | - Allow disabling bzip2 support with WITHOUT_BZIP2 - Fix handling patterns that start with a dot - Remove superfluous semicolon Approved by: delphij (mentor)
* Update BSD grep to the latest development version. It has some codegabor2011-10-051-52/+76
| | | | | | | | | | | | | backported that was written for the TRE integration project in Google Summer of Code 2011. This is a temporary solution until the whole regex library is not replaced so that BSD grep development can continue and the backported code gets some review and testing. This change only improves scalability slightly, there is no big performance boost yet but several minor bugs have been found and fixed. Approved by: delphij (mentor) Sposored by: Google Summer of Code 2011 MFC after: 1 week
* - Fix handling of environmental variables when they are set to empty stringgabor2011-08-171-3/+4
| | | | | Submitted by: ttsestt@gmail.com Approved by: re (kib), delphij (mentor)
* - Use REG_NOSUB to bypass submatch counting when not necessary. This maygabor2011-06-121-1/+5
| | | | | | yield in somewhat better performance in a few cases. Approved by: delphij (mentor)
* - Adjust a comment to actual behaviourgabor2011-04-071-0/+2
| | | | | | | | | - Makefile nit - Add more CVS/SVN keywords to make it easier to track changes from NetBSD in case they add further improvements Approved by: delphij (mentor) Obtained from: The NetBSD Project
* Revert a minor part of revision 211364:delphij2010-08-191-4/+1
| | | | | | | | | | - Imply -h if single file is grepped, this is the GNU behaviour This is already done by code above the change and have caused a regression since this instance of code does not check Hflag. Reported by: davidxu Pointy hat to: delphij
* UTFize my name.des2010-08-191-1/+1
|
* - Revert strlcpy() changes to memcpy() because it's more efficient andgabor2010-08-151-25/+24
| | | | | | | | | | | | | | | | | | | | | | | former may be safer but in this case it doesn't add extra safety [1] - Fix -w option [2] - Fix handling of GREP_OPTIONS [3] - Fix --line-buffered - Make stdin input imply --line-buffered so that tail -f can be piped to grep [4] - Imply -h if single file is grepped, this is the GNU behaviour - Reduce locking overhead to gain some more performance [5] - Inline some functions to help the compiler better optimize the code - Use shortcut for empty files [6] PR: bin/149425 [6] Prodded by: jilles [1] Reported by: Alex Kozlov <spam@rm-rf.kiev.ua> [2] [3], swell.k@gmail.com [2], poyopoyo@puripuri.plala.or.jp [4] Submitted by: scf [5], Shuichi KITAGUCHI <ki@hh.iij4u.or.jp> [6] Approved by: delphij (mentor)
* - Some minor changes to the messages to increase usefulness of error msgsgabor2010-07-291-15/+10
| | | | | | Reviewed by: hrs (Japanese catalogs), pluknet <pluknet at gmail dot com> (Russian catalog) Approved by: delphij (mentor)
* - Use the traditional behaviour for filename and directory name inclusiongabor2010-07-291-31/+45
| | | | | | | | | and exclusion patterns [1] - Some improvements on the exiting code, like replacing memcpy with strlcpy/strcpy Approved by: delphij (mentor) Pointed out by: bf [1], des [1]
* - Fix --color behaviour to only output color sequences if stdout is a ttygabor2010-07-251-24/+50
| | | | | | | | | | | | or if forced mode is specified [1] - While here, add some alternative names for the options and make then case-insensitive - Fix -q and -l behaviour [2] - Some small changes to make the code easier to review Submitted by: swell.k@gmail.com [1], dougb [2] Approved by: delphij (mentor)
* Fix crashes when using grep -R:delphij2010-07-231-2/+2
| | | | | | | | - Explicitly pre-zero memory for fts_open parameters. - Don't test against directory patterns when we are testing direct leaf of current directory. While I'm there plug a few of memory leaks.
* Add BSD grep to the base system and make it our default grep.gabor2010-07-221-0/+667
Deliverables: Small and clean code (1,4 KSLOC vs GNU's 8,5 KSLOC), lower memory usage than GNU grep, GNU compatibility, BSD license. TODO: Performance is somewhat behind GNU grep but it is only significant for bigger searches. The reason is complex, the most important factor is that GNU grep uses lots of optimizations to improve the speed of the regex library. First, we need a modern regex library (practically by adopting TRE), add support for GNU-style non-standard regexes and then reevalute the performance issues and look for bottlenecks. In the meantime, for those, who need better performance, it is possible to build GNU grep by setting WITH_GNU_GREP. Approved by: delphij (mentor) Obtained from: OpenBSD (http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/grep/), freegrep (http://github.com/howardjp/freegrep) Sponsored by: Google SoC 2008 Portbuild tests run by: kris, pav, erwin Acknowledgements to: fjoe (as SoC 2008 mentor), everyone who helped in reviewing and testing
OpenPOWER on IntegriCloud