View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000634 | 1003.1(2008)/Issue 7 | Shell and Utilities | public | 2012-12-04 21:56 | 2024-06-11 08:52 |
Reporter | weeks | Assigned To | ajosey | ||
Priority | normal | Severity | Editorial | Type | Enhancement Request |
Status | Closed | Resolution | Accepted As Marked | ||
Name | Nathan Weeks | ||||
Organization | USDA-ARS | ||||
User Reference | |||||
Section | awk | ||||
Page Number | 2445 | ||||
Line Number | 77748 | ||||
Interp Status | --- | ||||
Final Accepted Text | 0000634:0001427 | ||||
Summary | 0000634: add fflush built-in function to awk | ||||
Description | fflush() is a useful extension that has long been available in the most versions of awk, and is implemented in at least the following modern versions: * gawk 4.0.1 * mawk 1.3.4-20121129 * BWK awk 20110810 * BusyBox 1.20.2 awk * awka 0.7.5 It is absent from: * jawk 1.02 * AIX 7.1 /usr/bin/awk * HP-UX 11i v2 /usr/bin/awk * Solaris 10 /usr/xpg4/bin/awk This request is being put forth after a discussion initiated by Arnold Robbins, the gawk maintainer, that included Thomas Dickey, who maintains mawk. Both have recently made changes to their respective implementations to more closely conform to the proposed description for the fflush built-in function. The suggested description for fflush was chosen while being cognizant of the following implementation differences: In mawk 1.3.4-20121129 and BusyBox 1.20.2 awk, 'flush()' (without an argument) flushes only stdout. This was also true of gawk 4.0.1, but a change was recently to the trunk that makes both 'flush()' and 'flush("")' flush all relevant open output files & pipes to mimic the BWK awk behavior (and desired behavior for POSIX): http://git.savannah.gnu.org/cgit/gawk.git/commit/?id=db20bfeba4c618f380315e18e6433fb6b8e63c26 In BWK awk, 'fflush(expression)' returns EOF, whereas gawk and mawk return -1, hence the wording "If fflush is successful, it shall return 0; otherwise, it shall return non-zero." This could be "shall return a negative integer", but I chose the current wording for consistency with the description of "close". In BWK awk, 'fflush()' and 'fflush("")' always return 0. In my opinion, this isn't contradictory to the proposed description for the fflush built-in function. BWK awk allows 'fflush' without an argument list. This usage isn't a good candidate for standardization for the reasons described in the "rationale" section. In BusyBox 1.20.2 awk, any invocation of fflush returns 0. Before mawk 1.3.4-20121129, if an internal C fflush() call failed while executing awk fflush built-in function, mawk would exit with a non-zero exit status. In the 1.3.4-20121129 release, the awk fflush function will now return -1 instead. | ||||
Desired Action | 1. Add a description for fflush() to the "Input/Output and General Functions" section: fflush([expression]) Write any unwritten data to the file or pipe opened by a print or printf statement with the same string-valued expression. If no argument, or if expression evaluates to the null string, then write all such data for all such open files and pipes. If fflush is successful, it shall return 0; otherwise, it shall return non-zero. 2. List fflush in the description of the BUILTIN_FUNC_NAME token in the Grammar 3. Add fflush to the list of functions that BUILTIN_FUNC_NAME represents in "Lexical Conventions" #11 | ||||
Tags | issue8 |
|
After page 2445 line 77748 add to the "Input/Output and General Functions" section: fflush([expression]) Write any unwritten data to the file or piped stream opened by a print or printf statement with the same string-valued expression. If no argument, or if expression evaluates to the null string, then write all such data for all such open files and piped streams, and standard output. If fflush is successful, it shall return 0; otherwise, it shall return non-zero. At page 2447 line 77841 add "fflush" after "close" in the description of the BUILTIN_FUNC_NAME token in the Grammar. At page 2454 line 78177 add "fflush" in the appropriate alphabetical position to the list of functions that BUILTIN_FUNC_NAME represents in "Lexical Conventions" #11. |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-12-04 21:56 | weeks | New Issue | |
2012-12-04 21:56 | weeks | Status | New => Under Review |
2012-12-04 21:56 | weeks | Assigned To | => ajosey |
2012-12-04 21:56 | weeks | Name | => Nathan Weeks |
2012-12-04 21:56 | weeks | Organization | => USDA-ARS |
2012-12-04 21:56 | weeks | Section | => awk |
2012-12-04 21:56 | weeks | Page Number | => 0 |
2012-12-04 21:56 | weeks | Line Number | => 0 |
2012-12-05 16:49 | geoffclare | Note Added: 0001427 | |
2012-12-05 16:52 | geoffclare | Page Number | 0 => 2445 |
2012-12-05 16:52 | geoffclare | Line Number | 0 => 77748 |
2012-12-05 16:52 | geoffclare | Interp Status | => --- |
2012-12-05 16:52 | geoffclare | Final Accepted Text | => 0000634:0001427 |
2012-12-05 16:52 | geoffclare | Status | Under Review => Resolved |
2012-12-05 16:52 | geoffclare | Resolution | Open => Accepted As Marked |
2012-12-05 16:52 | geoffclare | Tag Attached: issue8 | |
2012-12-05 17:00 | geoffclare | Note Edited: 0001427 | |
2020-03-23 10:43 | geoffclare | Status | Resolved => Applied |
2024-06-11 08:52 | agadmin | Status | Applied => Closed |