void LYexit( int status ) { if ( LYOutOfMemory == 1 ) { signal( 1, 1 ); signal( 15, 1 ); signal( 2, 1 ); signal( 11, 1 ); signal( 4, 1 ); fflush( stderr ); fflush( stdout ); if ( LYCursesON ) LYSleepAlert( ); cleanup_sig( 0 ); signal( 11, 0 ); signal( 4, 0 ); } LYCloselog( ); LYCompleteExit( ); LYCloseCmdLogfile( ); cleanup_files( ); fflush( stderr ); if ( LYOutOfMemory == 1 ) { LYOutOfMemory = 0; printf( "\r\n%s\r\n\r\n", gettext( "Memory exhausted! Program aborted!" ) ); fflush( stdout ); } LYCloseTracelog( ); exit( status ); }
void cleanup(void) { #ifdef VMS extern BOOLEAN DidCleanup; #endif /* VMS */ /* * Cleanup signals - just in case. Ignore further interrupts. - mhc: * 11/2/91 */ #ifndef NOSIGHUP (void) signal(SIGHUP, SIG_IGN); #endif /* NOSIGHUP */ (void) signal(SIGTERM, SIG_IGN); #ifndef VMS /* use ttclose() from cleanup() for VMS */ (void) signal(SIGINT, SIG_IGN); #endif /* !VMS */ if (LYCursesON) { LYmove(LYlines - 1, 0); LYclrtoeol(); lynx_stop_all_colors(); LYrefresh(); stop_curses(); } #ifdef EXP_CHARTRANS_AUTOSWITCH /* * Currently implemented only for LINUX: Restore original font. */ UCChangeTerminalCodepage(-1, (LYUCcharset *) 0); #endif /* EXP_CHARTRANS_AUTOSWITCH */ #ifdef USE_PERSISTENT_COOKIES /* * This can go right here for now. We need to work up a better place * to save cookies for the next release, preferably whenever a new * persistent cookie is received or used. Some sort of protocol to * handle two processes writing to the cookie file needs to be worked * out as well. */ if (persistent_cookies) LYStoreCookies(LYCookieSaveFile); #endif cleanup_files(); #ifdef VMS ttclose(); DidCleanup = TRUE; #endif /* VMS */ /* * If we're looking at memory leaks, hang onto the trace file, since there * is no memory freed in this function, and it is a nuisance to not be able * to trace the cleanup activity -TD */ #ifndef LY_FIND_LEAKS LYCloseTracelog(); #endif }