(0003231)
rhansen (manager)
2016-05-19 16:31
edited on: 2016-05-19 16:43
|
Interpretation response
------------------------
The standard does not speak to this issue, and as such no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.
Rationale:
-------------
None.
Notes to the Editor (not part of this interpretation):
-------------------------------------------------------
On page 2460 line 78773-78779 section awk, change:ARGC The number of elements in the ARGV array.
ARGV An array of command line arguments, excluding options and the program argument, numbered from zero to ARGC-1.
The arguments in ARGV can be modified or added to; ARGC can be altered. As each input file ends, awk shall treat the next non-null element of ARGV, up to the current value of ARGC-1, inclusive, as the name of the next input file. Thus, setting an element of ARGV to null means that it shall not be treated as an input file. The name '-' indicates the standard input. If an argument matches the format of an assignment operand, this argument shall be treated as an assignment rather than a file argument. to:ARGC A number determining when the iteration described for ARGV stops. When an awk program starts, ARGC shall be initialized to the number of elements in the ARGV array. ARGC can be updated by the awk program and by assignment operands. If ARGC is set to a value less than 1, the behavior is unspecified. It is unspecified whether alterations to ARGC can be made using the -v option.
ARGV An array containing, initially, the command name (see [xref to 2.9.1]) used to invoke awk in <tt>ARGV[0]</tt> and the command line arguments, if any, excluding options and the program operand, in <tt>ARGV[1]</tt> through <tt>ARGV[ARGC−1]</tt>. The elements in ARGV can be assigned new values or deleted, and new elements can be added. It is unspecified whether this alteration to ARGV can be made using the -v option.
After processing the BEGIN actions, if any, awk begins interating over the elements of ARGV, processing them as if they were argument operands. It shall behave as if the implementation maintains an internal counter that is initialized to 1 and increments by 1 at the end of each iteration. For each iteration, the following shall occur:- If the internal counter is greater than or equal to the current value of ARGC and no file operands have been processed, awk shall set FILENAME to '-' and process standard input as if it was given as a file operand. The internal counter shall not be incremented at the end of this iteration.
- Otherwise, if the internal counter is greater than or equal to the current value of ARGC, the iterations shall stop and processing of the END actions, if any, shall begin. Any ARGV elements with index values greater than or equal to ARGC shall not be processed as argument operands.
- Otherwise, if the element <tt>ARGV[</tt>internal counter value<tt>]</tt> does not exist, it is unspecified whether that element is created. No other action shall be taken.
- Otherwise, if <tt>ARGV[</tt>internal counter value<tt>]</tt> is a null string, no action is taken.
- Otherwise, if <tt>ARGV[</tt>internal counter value<tt>]</tt> matches the format of an assignment operand (see OPERANDS), awk shall proccess the assignment.
- Otherwise, <tt>ARGV[</tt>internal counter value<tt>]</tt> shall be treated as a file operand, FILENAME shall be set to that value, and the named file, or standard input if the value is '-', shall be processed as an input file.
Since only non-null elements are processed, setting an element of ARGV to the null string or deleting it means that it shall not be treated as an argument operand.
On page 2460, lines 78798-78800 section awk EXTENDED DESCRIPTION, change the definition of the FILENAME variable:A pathname of the current input file. Inside a BEGIN action the value is undefined. Inside an END action the value shall be the name of the last input file processed. to:The pathname used to open the current input file, or '-' if the file is standard input. Inside a BEGIN action FILENAME shall be unset. Inside an END action the value shall be the name of the last input file processed. If an application changes the value of FILENAME, the results are unspecified.
On page 2453 line 78479 section awk, change:If no file operands are specified, or if a file operand is '-', the standard input shall be used. to:If no file operands or their equivalents, achieved by modifying the awk variables ARGV and ARGC, are specified, or if a file operand is '-', the standard input shall be used.
On page 2453 line 78502 section awk, change:If there are no file arguments, assignments shall be executed before processing the standard input. to:If there are no file arguments or their equivalents, achieved by modifying the awk variables ARGV and ARGC, assignments shall be executed before processing the standard input.
On page 2453 line 78506 section awk, change:The standard input shall be used only if no file operands are specified, or if a file operand is '-', or if a progfile option-argument is '-'; see the INPUT FILES section. to:The standard input shall be used only if no file operands or their equivalents, achieved by modifying the awk variables ARGV and ARGC, are specified; or if a file operand, or its equivalent, is '-'; or if a progfile option-argument is '-'; see the INPUT FILES section.
On page 2453 line 78514 section awk, change:Standard input in the absence of any file operands to:Standard input in the absence of any file operands, or their equivalents
On page 2478 after line 79587 section awk APPLICATION USAGE, add a new paragraph:To specify a file operand naming a file with a name containing an <equals-sign>, users can use "./" as the first two characters of a relative file pathname that starts with an <underscore> or an alphabetic character to keep the file operand from being interpreted as an assignment operand. Similarly, "./-" can be used to access a file named '-' in the current directory rather than use standard input.
|