summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAlain Magloire <alainm@rcsm.ee.mcgill.ca>2000-01-17 00:55:06 +0000
committerAlain Magloire <alainm@rcsm.ee.mcgill.ca>2000-01-17 00:55:06 +0000
commitc5b5567e5d265cb8d7171e7d2add249bfefbf685 (patch)
tree24b7402a0dc2771b86cdfa9344f771da3ad4cf64 /doc
parentb889cf3d9b14aafcc10f958b0e568334f7293991 (diff)
downloadgrep-c5b5567e5d265cb8d7171e7d2add249bfefbf685.tar.gz
ChangeLog NEWS THANKS doc/grep.1 doc/grep.texi src/grep.c
src/system.h Support for general option --binary-file from David O'Brien. Inititial patch from David O'Brien. Add --binary-files option. * NEWS, doc/grep.1, doc/grep.texi: Document it. * src/grep.c (BINARY_FILES_OPTION): New constant. (long_options, grep, usage, main): New --binary-files option. (binary_files): New var. * src/system.h (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, CHAR_MAX): New macros. (INT_MAX, UCHAR_MAX): Define in terms of TYPE_MAXIMUM.
Diffstat (limited to 'doc')
-rw-r--r--doc/grep.154
-rw-r--r--doc/grep.texi27
2 files changed, 59 insertions, 22 deletions
diff --git a/doc/grep.1 b/doc/grep.1
index 0cee267f..f6f54852 100644
--- a/doc/grep.1
+++ b/doc/grep.1
@@ -12,7 +12,7 @@
.de Id
.ds Dt \\$4
..
-.Id $Id: grep.1,v 1.7 1999/10/12 20:41:01 alainm Exp $
+.Id $Id: grep.1,v 1.8 2000/01/17 00:55:06 alainm Exp $
.TH GREP 1 \*(Dt "GNU Project"
.SH NAME
grep, egrep, fgrep \- print lines matching a pattern
@@ -28,6 +28,7 @@ grep, egrep, fgrep \- print lines matching a pattern
.IR FILE ]
.RB [ \-d
.IR ACTION ]
+.RB [ \-\^\-binary-files=\fITYPE\fP ]
.RB [ \-\^\-directories=\fIACTION\fP ]
.RB [ \-\^\-extended-regexp ]
.RB [ \-\^\-fixed-strings ]
@@ -143,6 +144,41 @@ Print the version number of
to standard error. This version number should
be included in all bug reports (see below).
.TP
+.BI \-\^\-binary-files= TYPE
+If the first few bytes of a file indicate that the file contains binary
+data, assume that the file is of type
+.IR TYPE .
+By default,
+.I TYPE
+is
+.BR binary ,
+and
+.B grep
+normally outputs either
+a one-line message saying that a binary file matches, or no message if
+there is no match.
+If
+.I TYPE
+is
+.BR without-match ,
+.B grep
+assumes that a binary file does not match.
+If
+.I TYPE
+is
+.BR text ,
+.B grep
+processes a binary file as if it were text; this is equivalent to the
+.B \-a
+or
+.B \-\^\-text
+option.
+.I Warning:
+.B "grep \-\^\-binary-files=text"
+might output binary garbage,
+which can have nasty side effects if the output is a terminal and if the
+terminal driver interprets some of it as commands.
+.TP
.BR \-b ", " \-\^\-byte-offset
Print the byte offset within the input file before
each line of output.
@@ -257,15 +293,9 @@ and
and should redirect output to /dev/null instead.
.TP
.BR \-a ", " \-\^\-text
-Do not suppress output lines that contain binary data.
-Normally, if the first few bytes of a file indicate that
-the file contains binary data,
-.B grep
-outputs only a message saying that the file matches the pattern.
-This option causes
-.B grep
-to act as if the file is a text file,
-even if it would otherwise be treated as binary.
+Process a binary file as if it were text; this is equivalent to the
+.B \-\^\-binary-files=text
+option.
.TP
.BR \-v ", " \-\^\-invert-match
Invert the sense of matching, to select non-matching lines.
@@ -323,9 +353,9 @@ system call to read input, instead of
the default
.BR read (2)
system call. In some situations,
-.B -\^-mmap
+.B \-\^\-mmap
yields better performance. However,
-.B -\^-mmap
+.B \-\^\-mmap
can cause undefined behavior (including core dumps)
if an input file shrinks while
.B grep
diff --git a/doc/grep.texi b/doc/grep.texi
index 50a6938a..d71f2c1b 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -275,6 +275,21 @@ This version number should be included in all bug reports.
Print a usage message briefly summarizing these command-line options
and the bug-reporting address, then exit.
+@itemx --binary-files=@var{type}
+@opindex --binary-files
+@cindex binary files
+If the first few bytes of a file indicate that the file contains binary
+data, assume that the file is of type @var{type}. By default,
+@var{type} is @samp{binary}, and @command{grep} normally outputs either
+a one-line message saying that a binary file matches, or no message if
+there is no match. If @var{type} is @samp{without-match},
+@command{grep} assumes that a binary file does not match. If @var{type}
+is @samp{text}, @command{grep} processes a binary file as if it were
+text; this is equivalent to the @samp{-a} or @samp{--text} option.
+@emph{Warning:} @samp{--binary-files=text} might output binary garbage,
+which can have nasty side effects if the output is a terminal and if the
+terminal driver interprets some of it as commands.
+
@item -b
@itemx --byte-offset
@opindex -b
@@ -329,16 +344,8 @@ The scanning of every file will stop on the first match.
@opindex --text
@cindex suppress binary data
@cindex binary files
-Do not suppress output lines that contain binary data.
-Normally, if the first few bytes of a file indicate
-that the file contains binary data, grep outputs only a
-message saying that the file matches the pattern. This
-option causes grep to act as if the file is a text
-file, even if it would otherwise be treated as binary.
-@emph{Warning:} the result might be binary garbage
-printed to the terminal, which can have nasty
-side-effects if the terminal driver interprets some of
-it as commands.
+Process a binary file as if it were text; this is equivalent to the
+@samp{--binary-files=text} option.
@item -w
@itemx --word-regexp