3.  Exceptional Conditions

3.1.  Errors and interrupts

      When errors occur ex (optionally) rings the terminal bell and, in any case, prints an error diagnostic. If the primary input is from a file, editor processing will terminate. If an interrupt signal is received, ex prints ``Interrupt'' and returns to its command level. If the primary input is a file, then ex will exit when this occurs.

3.2.  Recovering from hangups and crashes

      If a hangup signal is received and the buffer has been modified since it was last written out, or if the system crashes, either the editor (in the first case) or the system (after it reboots in the second) will attempt to preserve the buffer. The next time you log in you should be able to recover the work you were doing, losing at most a few lines of changes from the last point before the hangup or editor crash. To recover a file you can use the -r option. If you were editing the file resume, then you should change to the directory where you were when the crash occurred, giving the command

ex -r resume
After checking that the retrieved file is indeed ok, you can write it over the previous contents of that file.

      You will normally get mail from the system telling you when a file has been saved after a crash. The command

ex -r
will print a list of the files which have been saved for you. (In the case of a hangup, the file will not appear in the list, although it can be recovered.)