WG15 Defect Report Ref: 9945-2-36
Topic: ed commands


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

.

Last update: 1997-05-20


								9945-2-36

 _____________________________________________________________________________


	Topic:			ed commands
	Relevant Sections:	4.20.7.3, 5.10.7, 5.35.7
	Classification:		Ambiguous


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

Reference: Page 263, Section 4.20.7.3, "ed Commands"
Reference: Page 519, Section 5.10.7, "Extended Description"
Reference: Page 629, Section 5.35.7, "Extended Description"

The standard does not seem to describe what behavior is required
from the three editors ed, ex, and vi when EOF is encountered
during either command input or text input.  Could you clarify for
me what the utility implementations are expected to do?

Historic practice appears to be both inconsistent and wrong.  I
strongly believe that the commands should behave very similarly
to what happens when a SIGHUP is received, i.e. save the user's
work so that it can be recovered, and exit with an error status.

(Keith Bostic)

WG15 response for 9945-2:1993 
-----------------------------------

The standard is unclear on this issue, and no conformance
distinction can be made between alternative implementations
based on this.  This is being referred to the sponsor. 
           

Rationale for Interpretation:
-----------------------------
None.



Editorial note for future revision of standard (not part of this interpretation)
-------------------------------------------------------------------------------
A proposed change to the section 4.20.7.3 ed Commands is as follows:
Replace the sixth paragraph with:

If an end-of-file is detected on standard input when input from the user 
is expected and the standard input is a terminal device, if the buffer
is not empty and has changed since the last write, the ed utility shall
attempt to write a copy of the buffer to a file. First, the file named
ed.hup in the current directory shall be used; if that fails, the file
named ed.hup in the directory named by the HOME environment variable
shall be used.

If an end-of-file is detected on standard input when input from the
user is expected and standard input is not a terminal device, the ed
utility shall not write the file to the currently remembered pathname
or return to command mode, and shall terminate with a nonzero exit status.

NOTE: There is no certainty that these comments will apply to any
revision of ISO/IEC 9945-2:1993.
 _____________________________________________________________________________