From 3a7fdd5f0ab0f89e7748efebb59b58054e2fa2c6 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. --- ChangeLog | 4 ++++ THANKS | 1 + gnulib | 2 +- sed/execute.c | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ac294f2..261c961 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-07-14 Padraig Brady + + * execute.c (open_next_file): Only reopen stdin on Windows/DOS. + 2011-05-27 Paolo Bonzini * doc/sed-in.texi: Explain behavior of \l and \u at the end diff --git a/THANKS b/THANKS index dc31732..0cbcb84 100644 --- a/THANKS +++ b/THANKS @@ -36,6 +36,7 @@ Maciej W. Rozycki Mark Kettenis Michael De La Rue Michel de Ruiter +Padraig Brady Paul Eggert Randall Cotton Robert A Bruce diff --git a/gnulib b/gnulib index afc6cbe..79aac72 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit afc6cbe4fe4892c5ee4166cab87fede6f294a27d +Subproject commit 79aac72351f56c4998c4cd176a7fd30a1598972b diff --git a/sed/execute.c b/sed/execute.c index 8416f0e..d190b2e 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)) ) {