The following term is used in this and following sections to
specify command and asynchronous event actions:
complete write
A complete write is a write of the entire contents of
the edit buffer to a file of a type other than a
terminal device, or the saving of the edit buffer
caused by the user executing the ex preserve
command.
Writing the contents of the edit buffer to a temporary
file that will be removed when the editor exits shall
not be considered a complete write.
The following actions shall be taken upon receipt of signals:
SIGINT If the standard input is not a terminal device, ex
shall not write the file or return to command or text
input mode, and shall exit with a non-zero exit status.
Otherwise, if executing an open or visual text input
mode command, ex in receipt of SIGINT shall behave
identically to its receipt of the <ESC> character.
Otherwise:
1. If executing an ex text input mode command, all
input lines that have been completely entered shall
be resolved into the edit buffer, and any partially
entered line shall be discarded.
2. If there is a currently executing command, it shall
be aborted and a message displayed. Unless
otherwise specified by the ex or vi command
descriptions, it is unspecified whether any lines
modified by the executing command appear modified,
or as they were before being modified by the
executing command, in the buffer.
If the currently executing command was a motion
command, its associated command shall be discarded.
3. If in open or visual command mode, the terminal
shall be alerted.
4. The editor shall then return to command mode.
SIGCONT The screen shall be refreshed if in open or visual
mode.
SIGHUP If the edit buffer has been modified since the last
complete write, ex shall attempt to save the edit
buffer so that it can be recovered later using the -r
option or the ex recover
command. The editor shall not
write the file or return to command or text input mode,
and shall terminate with a non-zero exit status.
SIGTERM Refer to SIGHUP.
The action taken for all other signals is unspecified.