summaryrefslogtreecommitdiff
path: root/doc/grep.texi
diff options
context:
space:
mode:
authorAlain Magloire <alainm@rcsm.ee.mcgill.ca>1999-10-12 20:41:01 +0000
committerAlain Magloire <alainm@rcsm.ee.mcgill.ca>1999-10-12 20:41:01 +0000
commitd65fb55711e5eecf14c2dbb79a1f0db19ee854e5 (patch)
tree1c38048aef381bca48007f8fa6d14a9a579e9e8f /doc/grep.texi
parentda75e9e83b27fe7a3f8edc8bb6df8af259fc19fe (diff)
downloadgrep-d65fb55711e5eecf14c2dbb79a1f0db19ee854e5.tar.gz
Changes buy P. E.
Changes buy P. E. * NEWS, doc/grep.1, doc/grep.texi: New option --mmap. * src/grep.c (mmap_option): New variable. (long_options, reset, usage): Add --mmap. Default is now read, not mmap. * doc/grep.1: Document -Z or --null. * doc/grep.texi: Fix texinfo glitches. POSIX -> POSIX.2 where appropriate. * doc/grep.texi: Fix texinfo glitches. POSIX -> POSIX.2 where appropriate. * acconfig.h (ssize_t): New #undef. * configure.in (AC_CHECK_TYPE): Add ssize_t. * src/grep.c (PREFERRED_SAVE_FACTOR): New macro. (reset): If the buffer has already been allocated, set bufsalloc to be bufalloc / PREFERRED_SAVE_FACTOR. This avoids problems when bufsalloc == bufalloc (possible after reading a large binary file). (reset): Use PREFERRED_SAVE_FACTOR instead of magic constant. Do not set bufbeg; nobody uses it. Always set buflim. Check for lseek error. Use SEEK_CUR, not a magic constant. (fillbuf): Return an error indication, not a count. All callers changed. Do not assume ssize_t fits in int. Use PREFERRED_SAVE_FACTOR instead of magic constant. Clean up mmap code. Do not attempt to mmap zero bytes. Check for lseek error. Use SEEK_SET, not a magic constant. Work correctly if read is interrupted. (grepfile): Work correctly if open or close is interrupted. * src/system.h (SEEK_SET, SEEK_CUR): New macros.
Diffstat (limited to 'doc/grep.texi')
-rw-r--r--doc/grep.texi56
1 files changed, 16 insertions, 40 deletions
diff --git a/doc/grep.texi b/doc/grep.texi
index 34e6e2f2..ca98c128 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -201,11 +201,11 @@ the first match. Also see the @samp{-s} or @samp{--no-messages} option.
@opindex --no-messages
@cindex suppress error messages
Suppress error messages about nonexistent or unreadable files.
-Portability note: unlike @sc{gnu} @command{grep}, @sc{bsd}
-@command{grep} does not comply with @sc{posix.2}, because @sc{bsd}
-@command{grep} lacks a @samp{-q} option and its @samp{-s} option behaves
+Portability note: unlike @sc{gnu} @command{grep}, traditional
+@command{grep} did not conform to @sc{posix.2}, because traditional
+@command{grep} lacked a @samp{-q} option and its @samp{-s} option behaved
like @sc{gnu} @command{grep}'s @samp{-q} option. Shell scripts intended
-to be portable to @sc{bsd} @command{grep} should avoid both
+to be portable to traditional @command{grep} should avoid both
@samp{-q} and @samp{-s} and should redirect
output to @file{/dev/null} instead.
@@ -751,42 +751,18 @@ instead use the backslashed versions @samp{\?}, @samp{\+}, @samp{\@{},
@samp{\|}, @samp{\(}, and @samp{\)}.
@cindex interval specifications
-There is a longstanding minor compatibility problem with regular
-expressions like @samp{x@{2,8@}} that use interval specifications.
-Traditional @command{egrep} did not support interval specifications, but
-@sc{posix.2} requires them, and says that the effect of regular
-expressions like @samp{x@{,8@}} or @samp{(@{2,8@})} is undefined because
-their interval specifications are invalid. In @command{grep} 2.3 and
-earlier, @samp{grep -E} acted as @sc{posix.2} required, but it reported an
-error when it encountered a @samp{@{} that was not the prefix of a valid
-interval specification. Had @command{egrep} 2.3 been equivalent to
-@samp{grep -E}, it would have broken old-fashioned scripts that assume
-that @samp{@{} is not special in egrep patterns. So @command{egrep} 2.3
-and earlier did not support interval specifications, even though
-@sc{posix.2} required it.
-
-This compatibility problem has been addressed by changing @samp{grep -E}
-to be less pedantic about invalid interval specifications. Instead of
-reporting an error, @samp{grep -E} assumes that @samp{@{} is not special
-if it would be the start of an invalid interval specification. For
-example, @samp{grep -E @{1} now searches for the two-character string
-@samp{@{1} instead of reporting a syntax error in the regular
-expression. @sc{posix.2} allows this behavior as an extension, and it is
-more compatible with what old-fashioned scripts expect of
-@command{egrep}.
-
-The new behavior is incompatible with the traditional behavior in the
-rare cases where @sc{posix.2} requires it. For example, @samp{egrep
-x@{5@}} is now equivalent to @samp{egrep xxxxx} as required by
-@sc{posix.2}, whereas it formerly was equivalent to @samp{egrep
-'x\@{5\@}'}. Incompatibilities like these occur only when a valid
-interval specification is found, not merely when @samp{@{} is found.
-
-This new behavior exists only to support old scripts that do not conform
-to @sc{posix.2}. @sc{posix.2} does not define the behavior of invalid
-interval specifications, and other @command{grep} implementations have
-differing behavior in this area, so new scripts should avoid them.
-
+Traditional @command{egrep} did not support the @samp{@{} metacharacter,
+and some @command{egrep} implementations support @samp{\@{} instead, so
+portable scripts should avoid @samp{@{} in @samp{egrep} patterns and
+should use @samp{[@{]} to match a literal @samp{@{}.
+
+@sc{gnu} @command{egrep} attempts to support traditional usage by
+assuming that @samp{@{} is not special if it would be the start of an
+invalid interval specification. For example, the shell command
+@samp{egrep '@{1'} searches for the two-character string @samp{@{1}
+instead of reporting a syntax error in the regular expression.
+@sc{posix.2} allows this behavior as an extension, but portable scripts
+should avoid it.
@node Reporting Bugs
@chapter Reporting bugs