[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gawk] fflush and redirection
From: |
Strefil |
Subject: |
[bug-gawk] fflush and redirection |
Date: |
Wed, 06 Jul 2011 19:59:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110628 Thunderbird/5.0 |
Hi.
I have wrote very simple scipt to process my files, like this:
$ cat > script.awk
#!/bin/awk -f
BEGINFILE {out = FILENAME ".out";} {print > out;}
If I launch
$./script.awk *.txt > /dev/null
it works well, but
$./script.awk *.txt
works very slowly because of continuous fflushing; variable
output_is_tty == 1 indeed. But I there is no tty output in my example!
What is about to examine (rp->flag & RED_FILE) in efwrite function?
diff -rau gawk-4.0.0/builtin.c gawk-4.0.0-new/builtin.c
--- gawk-4.0.0/builtin.c 2011-04-29 08:50:40.000000000 +0000
+++ gawk-4.0.0-new/builtin.c 2011-07-06 17:49:10.560797941 +0000
@@ -105,8 +105,9 @@
if (fwrite(ptr, size, count, fp) != count)
goto wrerror;
if (flush
- && (output_is_tty
- || (rp != NULL && (rp->flag & RED_NOBUF)))) {
+ && (rp != NULL && (rp->flag & RED_NOBUF)
+ || (output_is_tty
+ && (rp == NULL || !rp->flag & RED_FILE)))) {
fflush(fp);
if (ferror(fp))
goto wrerror;
Sincerely,
Strephil.
- [bug-gawk] fflush and redirection,
Strefil <=