summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-12-07 14:28:29 +0200
committerArnold D. Robbins <arnold@skeeve.com>2012-12-07 14:28:29 +0200
commitd20af67ae8a6a573a0db906f9c9960a092f21b41 (patch)
treeeb97d6b43b283985b3ddb7070ac8abb74f175f79
parent787d93719e61e44aa1ab66c8ecca9cd6ff4fddbf (diff)
downloadgawk-d20af67ae8a6a573a0db906f9c9960a092f21b41.tar.gz
fflush() is now POSIX. Fix code and document.
-rw-r--r--ChangeLog14
-rw-r--r--NEWS7
-rw-r--r--awkgram.c12
-rw-r--r--awkgram.y12
-rw-r--r--builtin.c26
-rw-r--r--doc/ChangeLog11
-rw-r--r--doc/awkcard.in11
-rw-r--r--doc/gawk.118
-rw-r--r--doc/gawk.info448
-rw-r--r--doc/gawk.texi44
10 files changed, 321 insertions, 282 deletions
diff --git a/ChangeLog b/ChangeLog
index 0b2b7f41..5b81ade5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-12-07 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkgram.y (tokentab): `fflush()' is now in POSIX, remove the
+ RESX flag. This was the last use, so delete the flag.
+ (yylex): Don't check RESX.
+
+ Thanks to Nathan Weeks <weeks@iastate.edu> for helping make this
+ happen.
+
2012-12-01 Arnold D. Robbins <arnold@skeeve.com>
* eval.c (r_interpret): For op_assign_concat, if both strings
@@ -10,6 +19,11 @@
* Update to bison 2.6.5. Various files regenerated.
+2012-11-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (do_fflush): Make fflush() and fflush("") both
+ flush everything. See the comment in the code.
+
2012-10-28 Arnold D. Robbins <arnold@skeeve.com>
* Update to bison 2.6.4. Various files regenerated.
diff --git a/NEWS b/NEWS
index b32c5767..0a392ced 100644
--- a/NEWS
+++ b/NEWS
@@ -9,7 +9,12 @@ Changes from 4.0.1 to 4.0.2
1. Infrastructure upgrades: Autoconf 2.69, Automake 1.12.4, bison 2.6.5.
-2. Various minor bug fixes and documentation updates.
+2. `fflush()', `nextfile', and `delete array' are all now part of POSIX.
+
+3. fflush() behavior changed to match BWK awk and for POSIX - now both
+ fflush() and fflush("") flush all open output redirections.
+
+4. Various minor bug fixes and documentation updates.
Changes from 4.0.0 to 4.0.1
---------------------------
diff --git a/awkgram.c b/awkgram.c
index ba32abcf..33f0d6cd 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -4294,9 +4294,8 @@ struct token {
# define NOT_OLD 0x0100 /* feature not in old awk */
# define NOT_POSIX 0x0200 /* feature not in POSIX */
# define GAWKX 0x0400 /* gawk extension */
-# define RESX 0x0800 /* Bell Labs Research extension */
-# define BREAK 0x1000 /* break allowed inside */
-# define CONTINUE 0x2000 /* continue allowed inside */
+# define BREAK 0x0800 /* break allowed inside */
+# define CONTINUE 0x1000 /* continue allowed inside */
NODE *(*ptr)(int); /* function that implements this keyword */
};
@@ -4351,7 +4350,7 @@ static const struct token tokentab[] = {
{"exit", Op_K_exit, LEX_EXIT, 0, 0},
{"exp", Op_builtin, LEX_BUILTIN, A(1), do_exp},
{"extension", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_ext},
-{"fflush", Op_builtin, LEX_BUILTIN, RESX|A(0)|A(1), do_fflush},
+{"fflush", Op_builtin, LEX_BUILTIN, A(0)|A(1), do_fflush},
{"for", Op_K_for, LEX_FOR, BREAK|CONTINUE, 0},
{"func", Op_func, LEX_FUNCTION, NOT_POSIX|NOT_OLD, 0},
{"function",Op_func, LEX_FUNCTION, NOT_OLD, 0},
@@ -5989,11 +5988,6 @@ retry:
tokentab[mid].operator);
warntab[mid] |= GAWKX;
}
- if ((tokentab[mid].flags & RESX) && ! (warntab[mid] & RESX)) {
- lintwarn(_("`%s' is a Bell Labs extension"),
- tokentab[mid].operator);
- warntab[mid] |= RESX;
- }
if ((tokentab[mid].flags & NOT_POSIX) && ! (warntab[mid] & NOT_POSIX)) {
lintwarn(_("POSIX does not allow `%s'"),
tokentab[mid].operator);
diff --git a/awkgram.y b/awkgram.y
index a3ee2787..cd1c092e 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -1786,9 +1786,8 @@ struct token {
# define NOT_OLD 0x0100 /* feature not in old awk */
# define NOT_POSIX 0x0200 /* feature not in POSIX */
# define GAWKX 0x0400 /* gawk extension */
-# define RESX 0x0800 /* Bell Labs Research extension */
-# define BREAK 0x1000 /* break allowed inside */
-# define CONTINUE 0x2000 /* continue allowed inside */
+# define BREAK 0x0800 /* break allowed inside */
+# define CONTINUE 0x1000 /* continue allowed inside */
NODE *(*ptr)(int); /* function that implements this keyword */
};
@@ -1843,7 +1842,7 @@ static const struct token tokentab[] = {
{"exit", Op_K_exit, LEX_EXIT, 0, 0},
{"exp", Op_builtin, LEX_BUILTIN, A(1), do_exp},
{"extension", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_ext},
-{"fflush", Op_builtin, LEX_BUILTIN, RESX|A(0)|A(1), do_fflush},
+{"fflush", Op_builtin, LEX_BUILTIN, A(0)|A(1), do_fflush},
{"for", Op_K_for, LEX_FOR, BREAK|CONTINUE, 0},
{"func", Op_func, LEX_FUNCTION, NOT_POSIX|NOT_OLD, 0},
{"function",Op_func, LEX_FUNCTION, NOT_OLD, 0},
@@ -3481,11 +3480,6 @@ retry:
tokentab[mid].operator);
warntab[mid] |= GAWKX;
}
- if ((tokentab[mid].flags & RESX) && ! (warntab[mid] & RESX)) {
- lintwarn(_("`%s' is a Bell Labs extension"),
- tokentab[mid].operator);
- warntab[mid] |= RESX;
- }
if ((tokentab[mid].flags & NOT_POSIX) && ! (warntab[mid] & NOT_POSIX)) {
lintwarn(_("POSIX does not allow `%s'"),
tokentab[mid].operator);
diff --git a/builtin.c b/builtin.c
index c4082126..aed9dfe5 100644
--- a/builtin.c
+++ b/builtin.c
@@ -174,24 +174,40 @@ do_fflush(int nargs)
int status = 0;
const char *file;
- /* fflush() --- flush stdout */
+ /*
+ * November, 2012.
+ * It turns out that circa 2002, when BWK
+ * added fflush() and fflush("") to his awk, he made both of
+ * them flush everything.
+ *
+ * Now, with our inside agent getting ready to try to get fflush()
+ * standardized in POSIX, we are going to make our awk consistent
+ * with his. This should not really affect anyone, as flushing
+ * everything also flushes stdout.
+ *
+ * So. Once upon a time:
+ * fflush() --- flush stdout
+ * fflush("") --- flush everything
+ * Now, both calls flush everything.
+ */
+
+ /* fflush() */
if (nargs == 0) {
- if (output_fp != stdout)
- (void) fflush(output_fp);
- status = fflush(stdout);
+ status = flush_io();
return make_number((AWKNUM) status);
}
tmp = POP_STRING();
file = tmp->stptr;
- /* fflush("") --- flush all */
+ /* fflush("") */
if (tmp->stlen == 0) {
status = flush_io();
DEREF(tmp);
return make_number((AWKNUM) status);
}
+ /* fflush("/some/path") */
rp = getredirect(tmp->stptr, tmp->stlen);
status = -1;
if (rp != NULL) {
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 00185def..2dbbd08f 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,14 @@
+2012-12-07 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawk.texi (I/O Functions): Document that fflush() is now part
+ of POSIX. Fix in a few other places as well.
+ * awkcard.in: Update for fflush().
+
+2012-11-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawk.texi (I/O Functions): Document new behavior for fflush().
+ * gawk.1: Update for fflush().
+
2012-10-13 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am: Add dgawk.1 to man page links created / removed
diff --git a/doc/awkcard.in b/doc/awkcard.in
index 65f36b4e..a0abfa74 100644
--- a/doc/awkcard.in
+++ b/doc/awkcard.in
@@ -1307,13 +1307,12 @@ the problem.\*(CX
.fi
.in +.2i
.ti -.2i
-\*(CL\*(FCfflush(\*(FR[\*(FIfile\^\*(FR]\*(FC)\*(FR
+\*(CD\*(FCfflush(\*(FR[\*(FIfile\^\*(FR]\*(FC)\*(FR
.br
Flush any buffers associated
-with the open output file or pipe \*(FIfile\*(FR.\*(CD
-\*(CBIf no \*(FIfile\fP, then flush standard output.
-If \*(FIfile\fP is null, then flush all open output files and pipes
-(\*(GK and \*(NK)\*(CD.
+with the open output file or pipe \*(FIfile\*(FR.
+If no \*(FIfile\fP, or if
+\*(FIfile\fP is null, then flush all open output files and pipes.
.ti -.2i
\*(FCprint\fP
.br
@@ -1946,7 +1945,7 @@ maintains it.\*(CX
.ES
.fi
\*(CDCopyright \(co 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
.sp .5
Permission is granted to make and distribute verbatim copies of this
reference card provided the copyright notice and this permission notice
diff --git a/doc/gawk.1 b/doc/gawk.1
index e26f9a2e..956c9888 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -14,7 +14,7 @@
. if \w'\(rq' .ds rq "\(rq
. \}
.\}
-.TH GAWK 1 "Nov 10 2011" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "Dec 07 2012" "Free Software Foundation" "Utility Commands"
.SH NAME
gawk \- pattern scanning and processing language
.SH SYNOPSIS
@@ -454,11 +454,6 @@ cannot be used in place of
.B ^
and
.BR ^= .
-.TP
-\(bu
-The
-.B fflush()
-function is not available.
.RE
.TP
.PD 0
@@ -2064,9 +2059,7 @@ Flush any buffers associated with the open output file or pipe
.IR file .
If
.I file
-is missing, then flush standard output.
-If
-.I file
+is missing or if it
is the null string,
then flush all open output files and pipes.
.PP
@@ -3358,13 +3351,6 @@ escape sequence.
.BR \-\^\-posix .)
.TP
\(bu
-The
-.B fflush()
-function.
-(Disabled with
-.BR \-\^\-posix .)
-.TP
-\(bu
The ability to continue lines after
.B ?
and
diff --git a/doc/gawk.info b/doc/gawk.info
index 2fe6ca0c..e23618b0 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -11456,7 +11456,7 @@ parameters are enclosed in square brackets ([ ]):
`fflush([FILENAME])'
Flush any buffered output associated with FILENAME, which is
either a file opened for writing or a shell command for
- redirecting output to a pipe or coprocess. (c.e.).
+ redirecting output to a pipe or coprocess.
Many utility programs "buffer" their output; i.e., they save
information to write to a disk file or the screen in memory until
@@ -11469,22 +11469,31 @@ parameters are enclosed in square brackets ([ ]):
function--`gawk' also buffers its output and the `fflush()'
function forces `gawk' to flush its buffers.
- `fflush()' was added to Brian Kernighan's version of `awk' in
- 1994; it is not part of the POSIX standard and is not available if
- `--posix' has been specified on the command line (*note Options::).
+ `fflush()' was added to Brian Kernighan's version of `awk' in 1994.
+ For over two decades, it was not part of the POSIX standard. As
+ of December, 2012, it was accepted for inclusion into the POSIX
+ standard. See the Austin Group website
+ (http://austingroupbugs.net/view.php?id=634).
+
+ POSIX standardizes `fflush()' as follows: If there is no argument,
+ or if the argument is the null string (`""'), then `awk' flushes
+ the buffers for _all_ open output files and pipes.
+
+ NOTE: Prior to version 4.0.2, `gawk' would flush only the
+ standard output if there was no argument, and flush all
+ output files and pipes if the argument was the null string.
+ This was changed in order to be compatible with Brian
+ Kernighan's `awk', in the hope that standardizing this
+ feature in POSIX would then be easier (which indeed helped).
- `gawk' extends the `fflush()' function in two ways. The first is
- to allow no argument at all. In this case, the buffer for the
- standard output is flushed. The second is to allow the null string
- (`""') as the argument. In this case, the buffers for _all_ open
- output files and pipes are flushed. Brian Kernighan's `awk' also
- supports these extensions.
+ With `gawk', you can use `fflush("/dev/stdout")' if you wish
+ to flush only the standard output.
`fflush()' returns zero if the buffer is successfully flushed;
- otherwise, it returns -1. In the case where all buffers are
- flushed, the return value is zero only if all buffers were flushed
- successfully. Otherwise, it is -1, and `gawk' warns about the
- problem FILENAME.
+ otherwise, it returns non-zero (`gawk' returns -1). In the case
+ where all buffers are flushed, the return value is zero only if
+ all buffers were flushed successfully. Otherwise, it is -1, and
+ `gawk' warns about the problem FILENAME.
`gawk' also issues a warning message if you attempt to flush a
file or pipe that was opened for reading (such as with `getline'),
@@ -11561,7 +11570,7 @@ Advanced Notes: Controlling Output Buffering with `system()'
The `fflush()' function provides explicit control over output buffering
for individual files and pipes. However, its use is not portable to
-many other `awk' implementations. An alternative method to flush output
+many older `awk' implementations. An alternative method to flush output
buffers is to call `system()' with a null string as its argument:
system("") # flush output
@@ -19970,7 +19979,8 @@ in his version of `awk'.
Definition Syntax::).
* The `fflush()' built-in function for flushing buffered output
- (*note I/O Functions::).
+ (*note I/O Functions::). As of December 2012, this function is
+ now standardized by POSIX.
*Note Common Extensions::, for a full list of the extensions
@@ -20148,7 +20158,6 @@ Feature BWK Awk Mawk GNU Awk
`nextfile' statement X X X
`delete' without subscript X X X
`length()' of an array X X
-`fflush()' function X X X
`BINMODE' variable X X

@@ -24803,7 +24812,7 @@ Index
* --re-interval option: Options. (line 227)
* --sandbox option: Options. (line 239)
* --sandbox option, disabling system() function: I/O Functions.
- (line 85)
+ (line 94)
* --sandbox option, input redirection with getline: Getline. (line 19)
* --sandbox option, output redirection with print, printf: Redirection.
(line 6)
@@ -24970,7 +24979,7 @@ Index
* adding, features to gawk: Adding Code. (line 6)
* adding, fields: Changing Fields. (line 53)
* adding, functions to gawk: Dynamic Extensions. (line 10)
-* advanced features, buffering: I/O Functions. (line 98)
+* advanced features, buffering: I/O Functions. (line 107)
* advanced features, close() function: Close Files And Pipes.
(line 131)
* advanced features, constants, values of: Nondecimal-numbers.
@@ -25285,8 +25294,8 @@ Index
* Buening, Andreas <2>: Contributors. (line 92)
* Buening, Andreas: Acknowledgments. (line 60)
* buffering, input/output <1>: Two-way I/O. (line 70)
-* buffering, input/output: I/O Functions. (line 130)
-* buffering, interactive vs. noninteractive: I/O Functions. (line 98)
+* buffering, input/output: I/O Functions. (line 139)
+* buffering, interactive vs. noninteractive: I/O Functions. (line 107)
* buffers, flushing: I/O Functions. (line 29)
* buffers, operators for: GNU Regexp Operators.
(line 48)
@@ -26085,7 +26094,6 @@ Index
* gawk, extensions, disabling: Options. (line 202)
* gawk, features, adding: Adding Code. (line 6)
* gawk, features, advanced: Advanced Features. (line 6)
-* gawk, fflush() function in: I/O Functions. (line 44)
* gawk, field separators and: User-modified. (line 77)
* gawk, FIELDWIDTHS variable in <1>: User-modified. (line 35)
* gawk, FIELDWIDTHS variable in: Constant Size. (line 22)
@@ -26313,7 +26321,7 @@ Index
* int() function: Numeric Functions. (line 23)
* integers: Basic Data Typing. (line 21)
* integers, unsigned: Basic Data Typing. (line 30)
-* interacting with other programs: I/O Functions. (line 63)
+* interacting with other programs: I/O Functions. (line 72)
* internal constant, INVALID_HANDLE: Internals. (line 160)
* internal function, assoc_clear(): Internals. (line 75)
* internal function, assoc_lookup(): Internals. (line 79)
@@ -27236,7 +27244,7 @@ Index
* switch statement: Switch Statement. (line 6)
* syntactic ambiguity: /= operator vs. /=.../ regexp constant: Assignment Ops.
(line 148)
-* system() function: I/O Functions. (line 63)
+* system() function: I/O Functions. (line 72)
* systime() function (gawk): Time Functions. (line 64)
* t debugger command (alias for tbreak): Breakpoint Control. (line 89)
* tbreak debugger command: Breakpoint Control. (line 89)
@@ -27299,7 +27307,7 @@ Index
(line 22)
* troubleshooting, fatal errors, printf format strings: Format Modifiers.
(line 159)
-* troubleshooting, fflush() function: I/O Functions. (line 51)
+* troubleshooting, fflush() function: I/O Functions. (line 60)
* troubleshooting, function call syntax: Function Calls. (line 28)
* troubleshooting, gawk: Compatibility Mode. (line 6)
* troubleshooting, gawk, bug reports: Bugs. (line 9)
@@ -27318,7 +27326,7 @@ Index
(line 38)
* troubleshooting, string concatenation: Concatenation. (line 27)
* troubleshooting, substr() function: String Functions. (line 499)
-* troubleshooting, system() function: I/O Functions. (line 85)
+* troubleshooting, system() function: I/O Functions. (line 94)
* troubleshooting, typographical errors, global variables: Options.
(line 98)
* true, logical: Truth Values. (line 6)
@@ -27708,199 +27716,199 @@ Ref: table-gensub-escapes480558
Ref: Gory Details-Footnote-1481765
Ref: Gory Details-Footnote-2481816
Node: I/O Functions481967
-Ref: I/O Functions-Footnote-1488622
-Node: Time Functions488769
-Ref: Time Functions-Footnote-1499661
-Ref: Time Functions-Footnote-2499729
-Ref: Time Functions-Footnote-3499887
-Ref: Time Functions-Footnote-4499998
-Ref: Time Functions-Footnote-5500110
-Ref: Time Functions-Footnote-6500337
-Node: Bitwise Functions500603
-Ref: table-bitwise-ops501161
-Ref: Bitwise Functions-Footnote-1505321
-Node: Type Functions505505
-Node: I18N Functions505975
-Node: User-defined507602
-Node: Definition Syntax508406
-Ref: Definition Syntax-Footnote-1513316
-Node: Function Example513385
-Node: Function Caveats515979
-Node: Calling A Function516400
-Node: Variable Scope517515
-Node: Pass By Value/Reference519490
-Node: Return Statement522930
-Node: Dynamic Typing525911
-Node: Indirect Calls526646
-Node: Internationalization536331
-Node: I18N and L10N537757
-Node: Explaining gettext538443
-Ref: Explaining gettext-Footnote-1543509
-Ref: Explaining gettext-Footnote-2543693
-Node: Programmer i18n543858
-Node: Translator i18n548058
-Node: String Extraction548851
-Ref: String Extraction-Footnote-1549812
-Node: Printf Ordering549898
-Ref: Printf Ordering-Footnote-1552682
-Node: I18N Portability552746
-Ref: I18N Portability-Footnote-1555195
-Node: I18N Example555258
-Ref: I18N Example-Footnote-1557893
-Node: Gawk I18N557965
-Node: Advanced Features558582
-Node: Nondecimal Data560095
-Node: Array Sorting561678
-Node: Controlling Array Traversal562375
-Node: Array Sorting Functions570612
-Ref: Array Sorting Functions-Footnote-1574286
-Ref: Array Sorting Functions-Footnote-2574379
-Node: Two-way I/O574573
-Ref: Two-way I/O-Footnote-1580005
-Node: TCP/IP Networking580075
-Node: Profiling582919
-Node: Library Functions590393
-Ref: Library Functions-Footnote-1593400
-Node: Library Names593571
-Ref: Library Names-Footnote-1597042
-Ref: Library Names-Footnote-2597262
-Node: General Functions597348
-Node: Strtonum Function598301
-Node: Assert Function601231
-Node: Round Function604557
-Node: Cliff Random Function606100
-Node: Ordinal Functions607116
-Ref: Ordinal Functions-Footnote-1610186
-Ref: Ordinal Functions-Footnote-2610438
-Node: Join Function610647
-Ref: Join Function-Footnote-1612418
-Node: Gettimeofday Function612618
-Node: Data File Management616333
-Node: Filetrans Function616965
-Node: Rewind Function621104
-Node: File Checking622491
-Node: Empty Files623585
-Node: Ignoring Assigns625815
-Node: Getopt Function627368
-Ref: Getopt Function-Footnote-1638672
-Node: Passwd Functions638875
-Ref: Passwd Functions-Footnote-1647850
-Node: Group Functions647938
-Node: Walking Arrays656022
-Node: Sample Programs657591
-Node: Running Examples658256
-Node: Clones658984
-Node: Cut Program660208
-Node: Egrep Program670053
-Ref: Egrep Program-Footnote-1677826
-Node: Id Program677936
-Node: Split Program681552
-Ref: Split Program-Footnote-1685071
-Node: Tee Program685199
-Node: Uniq Program688002
-Node: Wc Program695431
-Ref: Wc Program-Footnote-1699697
-Ref: Wc Program-Footnote-2699897
-Node: Miscellaneous Programs699989
-Node: Dupword Program701177
-Node: Alarm Program703208
-Node: Translate Program707957
-Ref: Translate Program-Footnote-1712344
-Ref: Translate Program-Footnote-2712572
-Node: Labels Program712706
-Ref: Labels Program-Footnote-1716077
-Node: Word Sorting716161
-Node: History Sorting720045
-Node: Extract Program721884
-Ref: Extract Program-Footnote-1729367
-Node: Simple Sed729495
-Node: Igawk Program732557
-Ref: Igawk Program-Footnote-1747714
-Ref: Igawk Program-Footnote-2747915
-Node: Anagram Program748053
-Node: Signature Program751121
-Node: Debugger752221
-Node: Debugging753132
-Node: Debugging Concepts753545
-Node: Debugging Terms755401
-Node: Awk Debugging758024
-Node: Sample dgawk session758916
-Node: dgawk invocation759408
-Node: Finding The Bug760590
-Node: List of Debugger Commands767076
-Node: Breakpoint Control768387
-Node: Dgawk Execution Control772023
-Node: Viewing And Changing Data775374
-Node: Dgawk Stack778711
-Node: Dgawk Info780171
-Node: Miscellaneous Dgawk Commands784119
-Node: Readline Support789547
-Node: Dgawk Limitations790385
-Node: Language History792574
-Node: V7/SVR3.1794086
-Node: SVR4796407
-Node: POSIX797849
-Node: BTL798857
-Node: POSIX/GNU799591
-Node: Common Extensions804742
-Node: Ranges and Locales805849
-Ref: Ranges and Locales-Footnote-1810467
-Ref: Ranges and Locales-Footnote-2810494
-Ref: Ranges and Locales-Footnote-3810754
-Node: Contributors810975
-Node: Installation815237
-Node: Gawk Distribution816131
-Node: Getting816615
-Node: Extracting817441
-Node: Distribution contents819133
-Node: Unix Installation824355
-Node: Quick Installation824972
-Node: Additional Configuration Options826934
-Node: Configuration Philosophy828411
-Node: Non-Unix Installation830753
-Node: PC Installation831211
-Node: PC Binary Installation832510
-Node: PC Compiling834525
-Node: PC Testing837469
-Node: PC Using838645
-Node: Cygwin842830
-Node: MSYS843830
-Node: VMS Installation844344
-Node: VMS Compilation844947
-Ref: VMS Compilation-Footnote-1845954
-Node: VMS Installation Details846012
-Node: VMS Running847647
-Node: VMS Old Gawk849254
-Node: Bugs849728
-Node: Other Versions853580
-Node: Notes858861
-Node: Compatibility Mode859553
-Node: Additions860336
-Node: Accessing The Source861148
-Node: Adding Code862573
-Node: New Ports868540
-Node: Dynamic Extensions872653
-Node: Internals874029
-Node: Plugin License883132
-Node: Sample Library883766
-Node: Internal File Description884452
-Node: Internal File Ops888167
-Ref: Internal File Ops-Footnote-1892948
-Node: Using Internal File Ops893088
-Node: Future Extensions895465
-Node: Basic Concepts897969
-Node: Basic High Level898726
-Ref: Basic High Level-Footnote-1902761
-Node: Basic Data Typing902946
-Node: Floating Point Issues907471
-Node: String Conversion Precision908554
-Ref: String Conversion Precision-Footnote-1910254
-Node: Unexpected Results910363
-Node: POSIX Floating Point Problems912189
-Ref: POSIX Floating Point Problems-Footnote-1915894
-Node: Glossary915932
-Node: Copying941107
-Node: GNU Free Documentation License978664
-Node: Index1003801
+Ref: I/O Functions-Footnote-1489072
+Node: Time Functions489219
+Ref: Time Functions-Footnote-1500111
+Ref: Time Functions-Footnote-2500179
+Ref: Time Functions-Footnote-3500337
+Ref: Time Functions-Footnote-4500448
+Ref: Time Functions-Footnote-5500560
+Ref: Time Functions-Footnote-6500787
+Node: Bitwise Functions501053
+Ref: table-bitwise-ops501611
+Ref: Bitwise Functions-Footnote-1505771
+Node: Type Functions505955
+Node: I18N Functions506425
+Node: User-defined508052
+Node: Definition Syntax508856
+Ref: Definition Syntax-Footnote-1513766
+Node: Function Example513835
+Node: Function Caveats516429
+Node: Calling A Function516850
+Node: Variable Scope517965
+Node: Pass By Value/Reference519940
+Node: Return Statement523380
+Node: Dynamic Typing526361
+Node: Indirect Calls527096
+Node: Internationalization536781
+Node: I18N and L10N538207
+Node: Explaining gettext538893
+Ref: Explaining gettext-Footnote-1543959
+Ref: Explaining gettext-Footnote-2544143
+Node: Programmer i18n544308
+Node: Translator i18n548508
+Node: String Extraction549301
+Ref: String Extraction-Footnote-1550262
+Node: Printf Ordering550348
+Ref: Printf Ordering-Footnote-1553132
+Node: I18N Portability553196
+Ref: I18N Portability-Footnote-1555645
+Node: I18N Example555708
+Ref: I18N Example-Footnote-1558343
+Node: Gawk I18N558415
+Node: Advanced Features559032
+Node: Nondecimal Data560545
+Node: Array Sorting562128
+Node: Controlling Array Traversal562825
+Node: Array Sorting Functions571062
+Ref: Array Sorting Functions-Footnote-1574736
+Ref: Array Sorting Functions-Footnote-2574829
+Node: Two-way I/O575023
+Ref: Two-way I/O-Footnote-1580455
+Node: TCP/IP Networking580525
+Node: Profiling583369
+Node: Library Functions590843
+Ref: Library Functions-Footnote-1593850
+Node: Library Names594021
+Ref: Library Names-Footnote-1597492
+Ref: Library Names-Footnote-2597712
+Node: General Functions597798
+Node: Strtonum Function598751
+Node: Assert Function601681
+Node: Round Function605007
+Node: Cliff Random Function606550
+Node: Ordinal Functions607566
+Ref: Ordinal Functions-Footnote-1610636
+Ref: Ordinal Functions-Footnote-2610888
+Node: Join Function611097
+Ref: Join Function-Footnote-1612868
+Node: Gettimeofday Function613068
+Node: Data File Management616783
+Node: Filetrans Function617415
+Node: Rewind Function621554
+Node: File Checking622941
+Node: Empty Files624035
+Node: Ignoring Assigns626265
+Node: Getopt Function627818
+Ref: Getopt Function-Footnote-1639122
+Node: Passwd Functions639325
+Ref: Passwd Functions-Footnote-1648300
+Node: Group Functions648388
+Node: Walking Arrays656472
+Node: Sample Programs658041
+Node: Running Examples658706
+Node: Clones659434
+Node: Cut Program660658
+Node: Egrep Program670503
+Ref: Egrep Program-Footnote-1678276
+Node: Id Program678386
+Node: Split Program682002
+Ref: Split Program-Footnote-1685521
+Node: Tee Program685649
+Node: Uniq Program688452
+Node: Wc Program695881
+Ref: Wc Program-Footnote-1700147
+Ref: Wc Program-Footnote-2700347
+Node: Miscellaneous Programs700439
+Node: Dupword Program701627
+Node: Alarm Program703658
+Node: Translate Program708407
+Ref: Translate Program-Footnote-1712794
+Ref: Translate Program-Footnote-2713022
+Node: Labels Program713156
+Ref: Labels Program-Footnote-1716527
+Node: Word Sorting716611
+Node: History Sorting720495
+Node: Extract Program722334
+Ref: Extract Program-Footnote-1729817
+Node: Simple Sed729945
+Node: Igawk Program733007
+Ref: Igawk Program-Footnote-1748164
+Ref: Igawk Program-Footnote-2748365
+Node: Anagram Program748503
+Node: Signature Program751571
+Node: Debugger752671
+Node: Debugging753582
+Node: Debugging Concepts753995
+Node: Debugging Terms755851
+Node: Awk Debugging758474
+Node: Sample dgawk session759366
+Node: dgawk invocation759858
+Node: Finding The Bug761040
+Node: List of Debugger Commands767526
+Node: Breakpoint Control768837
+Node: Dgawk Execution Control772473
+Node: Viewing And Changing Data775824
+Node: Dgawk Stack779161
+Node: Dgawk Info780621
+Node: Miscellaneous Dgawk Commands784569
+Node: Readline Support789997
+Node: Dgawk Limitations790835
+Node: Language History793024
+Node: V7/SVR3.1794536
+Node: SVR4796857
+Node: POSIX798299
+Node: BTL799307
+Node: POSIX/GNU800112
+Node: Common Extensions805263
+Node: Ranges and Locales806322
+Ref: Ranges and Locales-Footnote-1810940
+Ref: Ranges and Locales-Footnote-2810967
+Ref: Ranges and Locales-Footnote-3811227
+Node: Contributors811448
+Node: Installation815710
+Node: Gawk Distribution816604
+Node: Getting817088
+Node: Extracting817914
+Node: Distribution contents819606
+Node: Unix Installation824828
+Node: Quick Installation825445
+Node: Additional Configuration Options827407
+Node: Configuration Philosophy828884
+Node: Non-Unix Installation831226
+Node: PC Installation831684
+Node: PC Binary Installation832983
+Node: PC Compiling834998
+Node: PC Testing837942
+Node: PC Using839118
+Node: Cygwin843303
+Node: MSYS844303
+Node: VMS Installation844817
+Node: VMS Compilation845420
+Ref: VMS Compilation-Footnote-1846427
+Node: VMS Installation Details846485
+Node: VMS Running848120
+Node: VMS Old Gawk849727
+Node: Bugs850201
+Node: Other Versions854053
+Node: Notes859334
+Node: Compatibility Mode860026
+Node: Additions860809
+Node: Accessing The Source861621
+Node: Adding Code863046
+Node: New Ports869013
+Node: Dynamic Extensions873126
+Node: Internals874502
+Node: Plugin License883605
+Node: Sample Library884239
+Node: Internal File Description884925
+Node: Internal File Ops888640
+Ref: Internal File Ops-Footnote-1893421
+Node: Using Internal File Ops893561
+Node: Future Extensions895938
+Node: Basic Concepts898442
+Node: Basic High Level899199
+Ref: Basic High Level-Footnote-1903234
+Node: Basic Data Typing903419
+Node: Floating Point Issues907944
+Node: String Conversion Precision909027
+Ref: String Conversion Precision-Footnote-1910727
+Node: Unexpected Results910836
+Node: POSIX Floating Point Problems912662
+Ref: POSIX Floating Point Problems-Footnote-1916367
+Node: Glossary916405
+Node: Copying941580
+Node: GNU Free Documentation License979137
+Node: Index1004274

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index cfe6cc91..63e9cbd6 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -20,7 +20,7 @@
@c applies to and all the info about who's publishing this edition
@c These apply across the board.
-@set UPDATE-MONTH October, 2012
+@set UPDATE-MONTH December, 2012
@set VERSION 4.0
@set PATCHLEVEL 2
@@ -15515,7 +15515,7 @@ which discusses this feature in more detail and gives an example.
@cindex extensions, common@comma{} @code{fflush()} function
Flush any buffered output associated with @var{filename}, which is either a
file opened for writing or a shell command for redirecting output to
-a pipe or coprocess. @value{COMMONEXT}.
+a pipe or coprocess.
@cindex portability, @code{fflush()} function and
@cindex buffers, flushing
@@ -15532,23 +15532,35 @@ buffers its output and the @code{fflush()} function forces
@command{gawk} to flush its buffers.
@code{fflush()} was added to Brian Kernighan's
-version of @command{awk} in 1994; it is not part of the POSIX standard and is
-not available if @option{--posix} has been specified on the
-command line (@pxref{Options}).
-
-@cindex @command{gawk}, @code{fflush()} function in
-@command{gawk} extends the @code{fflush()} function in two ways. The first
-is to allow no argument at all. In this case, the buffer for the
-standard output is flushed. The second is to allow the null string
-(@w{@code{""}}) as the argument. In this case, the buffers for
-@emph{all} open output files and pipes are flushed.
-Brian Kernighan's @command{awk} also supports these extensions.
+version of @command{awk} in 1994.
+For over two decades, it was not part of the POSIX standard.
+As of December, 2012, it was accepted for
+inclusion into the POSIX standard.
+See @uref{http://austingroupbugs.net/view.php?id=634, the Austin Group website}.
+
+POSIX standardizes @code{fflush()} as follows: If there
+is no argument, or if the argument is the null string (@w{@code{""}}),
+then @command{awk} flushes the buffers for @emph{all} open output files
+and pipes.
+
+@quotation NOTE
+Prior to version 4.0.2, @command{gawk}
+would flush only the standard output if there was no argument,
+and flush all output files and pipes if the argument was the null
+string. This was changed in order to be compatible with Brian
+Kernighan's @command{awk}, in the hope that standardizing this
+feature in POSIX would then be easier (which indeed helped).
+
+With @command{gawk},
+you can use @samp{fflush("/dev/stdout")} if you wish to flush
+only the standard output.
+@end quotation
@c @cindex automatic warnings
@c @cindex warnings, automatic
@cindex troubleshooting, @code{fflush()} function
@code{fflush()} returns zero if the buffer is successfully flushed;
-otherwise, it returns @minus{}1.
+otherwise, it returns non-zero (@command{gawk} returns @minus{}1).
In the case where all buffers are flushed, the return value is zero
only if all buffers were flushed successfully. Otherwise, it is
@minus{}1, and @command{gawk} warns about the problem @var{filename}.
@@ -15656,7 +15668,7 @@ it is all buffered and sent down the pipe to @command{cat} in one shot.
@cindex output, buffering
The @code{fflush()} function provides explicit control over output buffering for
-individual files and pipes. However, its use is not portable to many other
+individual files and pipes. However, its use is not portable to many older
@command{awk} implementations. An alternative method to flush output
buffers is to call @code{system()} with a null string as its argument:
@@ -26753,6 +26765,7 @@ The use of @code{func} as an abbreviation for @code{function}
@item
The @code{fflush()} built-in function for flushing buffered output
(@pxref{I/O Functions}).
+As of December 2012, this function is now standardized by POSIX.
@ignore
@item
@@ -27068,7 +27081,6 @@ the three most widely-used freely available versions of @command{awk}
@item @code{nextfile} statement @tab X @tab X @tab X
@item @code{delete} without subscript @tab X @tab X @tab X
@item @code{length()} of an array @tab X @tab @tab X
-@item @code{fflush()} function @tab X @tab X @tab X
@item @code{BINMODE} variable @tab @tab X @tab X
@end multitable