summaryrefslogtreecommitdiff
path: root/sed
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2011-07-04 08:24:21 +0100
committerPaolo Bonzini <bonzini@gnu.org>2011-07-04 12:45:19 +0200
commit629ef76a75da7bafe7705b9fcb6e7aa6311d1d7b (patch)
tree10711dbf541a578cc3a6d9a33f7b2566c855ec5b /sed
parent607d56e0849a54860521393311df74b3cf0b3f89 (diff)
downloadsed-629ef76a75da7bafe7705b9fcb6e7aa6311d1d7b.tar.gz
avoid reopening stdin
This adjusts the change made in 3a8e165a, to not reopen stdin on platforms where there is no separate "binary mode". That added some overhead and also precludes the use of tools like `stdbuf -i...`. * execute.c (open_next_file): Only reopen stdin on windos.
Diffstat (limited to 'sed')
-rw-r--r--sed/execute.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sed/execute.c b/sed/execute.c
index befc8f9..076ed0a 100644
--- a/sed/execute.c
+++ b/sed/execute.c
@@ -701,7 +701,11 @@ open_next_file(name, input)
if (name[0] == '-' && name[1] == '\0' && !in_place_extension)
{
clearerr(stdin); /* clear any stale EOF indication */
+#if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(MSDOS) || defined(__EMX__)
input->fp = ck_fdopen (fileno (stdin), "stdin", read_mode, false);
+#else
+ input->fp = stdin;
+#endif
}
else if ( ! (input->fp = ck_fopen(name, read_mode, false)) )
{