From c4485ac49a977d666187db4c5c25045215976577 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 16 Feb 2017 08:51:34 -0800 Subject: 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. --- doc/grep.texi | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'doc') 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 -- cgit v1.2.1