>From 80d5c3a49b7819b14abf3ad728bb6253689ed1ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Mon, 4 Jul 2011 08:24:21 +0100 Subject: [PATCH] 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. --- sed/execute.c | 4 ++++ 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)) ) { -- 1.7.5.2