usr.bin/ex/ex_subr.c
/*
 * When a hangup occurs our actions are similar to a preserve
 * command.  If the buffer has not been [Modified], then we do
 * nothing but remove the temporary files and exit.
 * Otherwise, we sync the temp file and then attempt a preserve.
 * If the preserve succeeds, we unlink our temp files.
 * If the preserve fails, we leave the temp files as they are
 * as they are a backup even without preservation if they
 * are not removed.
 */
When a hangup occurs our actions are similar to a preserve
command.  If the buffer has not been [Modified], then we do
nothing but remove the temporary files and exit.
Otherwise, we sync the temp file and then attempt a preserve.
If the preserve succeeds, we unlink our temp files.
If the preserve fails, we leave the temp files as they are
as they are a backup even without preservation if they
are not removed.
When a hangup occurs our actions are similar to a preserve command . If the buffer has not been [ Modified ] then we do nothing but remove the temporary files and exit . Otherwise we sync the temp file and then attempt a preserve . If the preserve succeeds we unlink our temp files . If the preserve fails we leave the temp files as they are as they are a backup even without preservation if they are not removed .
void
onhup()
{
	signal(SIGINT, SIG_IGN);
	signal(SIGHUP, SIG_IGN);
	if (chng == 0) {
		cleanup(1);
		ex_exit(0);
	}
	if (setexit() == 0) {
		if (preserve()) {
			cleanup(1);
			ex_exit(0);
		}
	}
	ex_exit(1);
}
void onhup ( ) { signal ( SIGINT , SIG_IGN ) ; signal ( SIGHUP , SIG_IGN ) ; if ( chng == 0 ) { cleanup ( 1 ) ; ex_exit ( 0 ) ; } if ( setexit ( ) == 0 ) { if ( preserve ( ) ) { cleanup ( 1 ) ; ex_exit ( 0 ) ; } } ex_exit ( 1 ) ; }
When a hangup occurs our actions are similar to a preserve
 command.
When a hangup occurs our actions are similar to a preserve command .
/*
	 * USG tty driver can send multiple HUP's!!
	 */