WG15 Defect Report Ref: 9945-2-98
Topic: field splitting


This is an approved interpretation of 9945-2:1993.

.

Last update: 1997-05-20


								9945-2-98

 _____________________________________________________________________________

	Topic:			field splitting
	Relevant Sections:	3.6.5


Defect Report:
-----------------------

	Date: Wed, 15 Mar 95 10:58:34 EST
	From: [email protected] (Lisa Kowalski)

A question regarding field splitting has come up.
Consider the following script:

IFS=:
x=:
set -- $x
echo $#

The question is whether there should be a terminal empty field.
Historically, ksh has reported the number of fields as 1.
Moreover, if the number of fields was considered to be 2, there
would be no way to describe a single empty field.

However, standard 9945-2:1993 seems unclear on this point.
The relevant section (3.6.5) is quoted below.  (An addition
I made for brevity and clarity is marked with asterisks).
Would appreciate formal clarification.

Many thanks,

"Otherwise **(i.e., IFS is set, non-null, and not equal to space
tab, newline)** the following rules shall be applied in sequence.
The term "IFS white space" is used to mean any sequence (zero or
more instances) of white-space characters that are in the IFS value
(e.g., if IFS contains <space><comma><tab>, any sequence of
<space> and <tab> characters is considered IFS white space).

a. IFS white space shall be ignored at the beginning and end of the input.
b. Each occurence in the input of an IFS character that is not IFS
   IFS white space, along with any adjacent IFS white space, shall
   delimit a field, as described previously.
c. Nonzero-length IFS white space shall delimit a field."



Interpretation response
------------------------
According to the example, the number of fields is 1.  The standard 
consistantly uses delimiter as field terminator, not field seperator 
and conforming implementations must conform to this.



Rationale:
None
Forwarded to Interpretations group: Mar 16 1995
Proposed resolution circulated: May 16th
Comments due: June 15th
Finalised: June 16th 1995