Commit Graph

13 Commits

Author SHA1 Message Date
Mateusz Piotrowski
6ddfef55bd Adjust formatting of grep and zgrep manual pages.
grep(1) changes:
 - Pet mandoc & igor.
 - Stylize the text more with macros when appropriate.
 - Stylize equal signs in long options (e.g., "--color=auto") with
   the "Cm" macro as suggested by mdoc(7).
 - Add missing arguments to --exlude, --exclude-dir, --include and
   --include-dir.
 - Remove a duplicate entry for the --context flag.
 - Use a list in the EXAMPLES sections to make it easier to tell
   which paragraphs belong to which example.
 - Cross reference zgrep(1).

zgrep(1) changes:
 - Fix Nd.
 - Split synopsis into paragraphs for readability.
 - Cross reference bzip(1), grep(1) and xz(1).

Reviewed by:	bcr
Approved by:	mat (mentor)
Differential Revision:	https://reviews.freebsd.org/D16779
2018-08-20 22:23:59 +00:00
Kyle Evans
24a656c291 bsdgrep: Allow "-" to be passed to -f to mean "standard input"
A version of this patch was originally sent to me by se@, matching behavior
from newer versions of GNU grep.

While there have been some differences of opinion on whether stdin should be
closed or not after depleting it in process of -f, I've opted to leave stdin
open and just let the later matching stuff fail and result in a no-match.
I'm not married to the current behavior- it was generally chosen since we
are adopting this in particular from GNU grep, and I would like to stay
consistent without a strong argument to the contrary. The current behavior
isn't technically wrong, it's just fairly unfriendly to the developer-user
of grep that may not realize their usage is trivially invalid.

Submitted by:	se
2018-05-08 03:53:46 +00:00
Kyle Evans
bd509bdb85 bsdgrep(1): Sneak in some man page updates
- The --exclude{,-dir} and --include{,-dir} directives now match GNU
  behavior of being processed in order and latest matching directive wins

- --label was previously not really documented, and -L and -l did not
  indicate that --label applied to them

- The flags listed as being extensions to POSIX spec were not updated with
  the removal of compression-related flags

MFC after:	1 week
2018-04-25 16:28:51 +00:00
Baptiste Daroussin
4a5b420738 Remove compression support from bsdgrep
Compression support is now handled by an external script, remove it from the
bsdgrep(1) utility.
This removes the support for -Z -J -X and -M

Note: that it matches the changes in newer GNU grep

Reviewed by:	kevans
Approved by:	kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D15197
2018-04-25 14:40:15 +00:00
Ed Maste
5ee1ea02fd bsdgrep: add -z/--null-data support
-z treats input and output data as sequences of lines terminated by a
zero byte instead of a newline. This brings it more in line with GNU grep
and brings us closer to passing the current tests with BSD grep.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	cem
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D10101
2017-04-17 13:14:18 +00:00
Conrad Meyer
bf10f246fe bsdgrep(1): create rgrep link
Create a convenience rgrep link for bsdgrep(1) that observes 'grep -r'
behavior.

A follow-up to r316473.

Submitted by:	Kyle Evans <kevans91 at ksu.edu>
Reviewed by:	emaste (earlier version), cem
Differential Revision:	https://reviews.freebsd.org/D10109
2017-04-04 05:56:42 +00:00
Ed Maste
6b91f51703 bsdgrep: document ignored option -u
MSDOS and Windows GNU grep uses -u to mean "print byte offsets as if
running on an UNIX system." The option has no effect on systems that
do not use CRLF line endings.

PR:		171200
Submitted by:	deeptech71@gmail.com, Anders Jensen-Waud
MFC after:	1 month
2017-02-19 17:40:24 +00:00
Joel Dahl
7e700c30d2 mdoc: minor paragraph fixes. 2014-02-08 13:37:02 +00:00
Gabor Kovesdan
b66a823be8 - Adjust a comment to actual behaviour
- 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
2011-04-07 13:03:35 +00:00
Joel Dahl
a4f5b3dfeb Fix spelling. 2010-07-30 14:05:20 +00:00
Gabor Kovesdan
55e44f511d - Use the traditional behaviour for filename and directory name inclusion
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]
2010-07-29 00:11:14 +00:00
Gabor Kovesdan
e9a6792326 - Add Russian catalog [1]
- Fix two minor nits in manpage [2]
- style.Makefile(5)

Submitted by:   pluknet <pluknet at gmail.com> [1],
                Alex Kozlov <spam@rm-rf.kiev.ua> [2]
Reviewed by:    delphij
2010-07-23 17:42:42 +00:00
Gabor Kovesdan
4dc88ebedf Add BSD grep to the base system and make it our default grep.
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
2010-07-22 19:11:57 +00:00