/*---------------------------------------------------------------------- Set or reset what needs to be set when coming out of pico to run an alternate editor. Args: come_back -- If come_back is 0 we're going out of our environment to set up for an external editor. If come_back is 1 we're coming back into pine. ----------------------------------------------------------------------*/ int ttyfix(int come_back) { #if defined(DEBUG) && (!defined(DOS) || defined(_WINDOWS)) if(debugfile) fflush(debugfile); #endif if(come_back) { #ifdef OS2 enter_text_mode(NULL); #endif init_screen(); init_tty_driver(ps_global); init_keyboard(F_ON(F_USE_FK,ps_global)); #ifdef OS2 dont_interrupt(); #endif fix_windsize(ps_global); } else { EndInverse(); end_keyboard(F_ON(F_USE_FK,ps_global)); end_tty_driver(ps_global); end_screen(NULL, 0); #ifdef OS2 interrupt_ok(); #endif } return(0); }
/*---------------------------------------------------------------------- Reading input somehow failed and we need to shutdown now Args: none Result: pine exits ---*/ void read_bail(void) { dprint((1, "read_bail: cleaning up\n")); /* Do not bail out on a tcp timeout, instead close the troublesome stream */ if(ps_global->tcptimeout && some_stream_is_locked()){ ps_global->read_bail = 1; return; } end_signals(1); /* * This gets rid of temporary cache files for remote addrbooks. */ completely_done_with_adrbks(); /* * This flushes out deferred changes and gets rid of temporary cache * files for remote config files. */ if(ps_global->prc){ if(ps_global->prc->outstanding_pinerc_changes) write_pinerc(ps_global, Main, WRP_NOUSER); if(ps_global->prc->rd) rd_close_remdata(&ps_global->prc->rd); free_pinerc_s(&ps_global->prc); } /* as does this */ if(ps_global->post_prc){ if(ps_global->post_prc->outstanding_pinerc_changes) write_pinerc(ps_global, Post, WRP_NOUSER); if(ps_global->post_prc->rd) rd_close_remdata(&ps_global->post_prc->rd); free_pinerc_s(&ps_global->post_prc); } sp_end(); dprint((1, "done with read_bail clean up\n")); imap_flush_passwd_cache(TRUE); end_keyboard(F_ON(F_USE_FK,ps_global)); end_tty_driver(ps_global); if(filter_data_file(0)) our_unlink(filter_data_file(0)); exit(0); }
/*---------------------------------------------------------------------- Timeout when no user input for a long, long time. Treat it pretty much the same as if we got a HUP. Only difference is we sometimes turns the timeout off (when composing). ----------------------------------------------------------------------*/ void user_input_timeout_exit(int to_hours) { char msg[80]; dprint((1, "\n\n** Exiting: user input timeout (%d hours) **\n\n\n\n", to_hours)); snprintf(msg, sizeof(msg), _("\n\nAlpine timed out (No user input for %d %s)\n"), to_hours, to_hours > 1 ? "hours" : "hour"); msg[sizeof(msg)-1] = '\0'; fast_clean_up(); end_screen(msg, 0); end_titlebar(); end_keymenu(); end_keyboard(F_ON(F_USE_FK,ps_global)); end_tty_driver(ps_global); end_signals(0); #if defined(DEBUG) && (!defined(DOS) || defined(_WINDOWS)) if(debugfile) fclose(debugfile); #endif exit(0); }