diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-02-16 08:51:34 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-02-16 08:54:41 -0800 |
commit | c4485ac49a977d666187db4c5c25045215976577 (patch) | |
tree | 6252eb56d952c0fd58ca3c4341b572d47068bcbc /doc/grep.texi | |
parent | cde60563801884ae65546090b24cb92620b1f828 (diff) | |
download | grep-c4485ac49a977d666187db4c5c25045215976577.tar.gz |
Fix up recent -U patches
Inspired by a suggestion by Eric Blake (Bug#25707#17).
* bootstrap.conf (gnulib_modules): Add xbinary-io,
and remove binary-io and xfreopen.
* doc/grep.texi (Other Options):
Fix typo and reword to be a bit more general.
* src/grep.c: Include xbinary-io.h instead of xfreopen.h.
(grepfile): Open with O_BINARY if binary.
(grepdesc): No need for set_binary_mode now.
(grep_command_line_arg, main): Set stdin to binary mode if binary.
(main): Avoid unnecessary test of stdin == NULL.
Use xsetmode instead of xfreopen.
* src/system.h: Do not include binary-io.h.
Diffstat (limited to 'doc/grep.texi')
-rw-r--r-- | doc/grep.texi | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/doc/grep.texi b/doc/grep.texi index 94a06210..077c05f3 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -741,25 +741,26 @@ This can cause a performance penalty. @opindex -U @opindex --binary @cindex MS-Windows binary I/O -@cindex binary I/O, /MS-Windows -Under MS-Windows, use binary I/O when reading and writing files other +@cindex binary I/O +On platforms that distinguish between text and binary I/O, +use the latter when reading and writing files other than the user's terminal, so that all input bytes are read and written as-is. This overrides the default behavior where @command{grep} -follows the operating system's advice whether to use binary or text -I/O. When @command{grep} uses text I/O it reads a carriage -return--newline pair as a newline and a Control-Z as end-of-file, and -it writes a newline as a carriage return--newline pair. When this -option is combined with @option{--byte-offset} (@option{-b}), byte -counts treat each text I/O carriage return--newline as a single byte. - -When using text I/O, @option{--binary-files} heuristics are applied to -input data after text-I/O processing. These heuristics need not agree +follows the operating system's advice whether to use text or binary +I/O@. On MS-Windows when @command{grep} uses text I/O it reads a +carriage return--newline pair as a newline and a Control-Z as +end-of-file, and it writes a newline as a carriage return--newline +pair. + +When using text I/O @option{--byte-offset} (@option{-b}) counts and +@option{--binary-files} heuristics apply to input data after text-I/O +processing. Also, the @option{--binary-files} heuristics need not agree with the @option{--binary} option; that is, they may treat the data as text even if @option{--binary} is given, or vice versa. @xref{File and Directory Selection}. -This option has no effect on platforms other than MS-Windows. - +This option has no effect on GNU and other POSIX-compatible platforms, +which do not distinguish text from binary I/O. @item -z @itemx --null-data |