/*---------------------------------------------------------------------- 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); }
/*---------------------------------------------------------------------- Handle cleaning up mail streams and tty modes... Not much to do. Rely on periodic mail file check pointing. Don't try cleaning up screen or flushing output since stdout is likely already gone. To be safe, though, we'll at least restore the original tty mode. Also delete any remnant _DATAFILE_ from sending-filters. ----------------------------------------------------------------------*/ void fast_clean_up(void) { #if !defined(DOS) && !defined(OS2) int i; MAILSTREAM *m; #endif dprint((1, "fast_clean_up()\n")); if(ps_global->expunge_in_progress) { PineRaw(0); return; } /* * 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, cleanup_called_from_sig_handler ? WRP_NOUSER : WRP_NONE); 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, cleanup_called_from_sig_handler ? WRP_NOUSER : WRP_NONE); if(ps_global->post_prc->rd) rd_close_remdata(&ps_global->post_prc->rd); free_pinerc_s(&ps_global->post_prc); } /* * Can't figure out why this section is inside the ifdef, but no * harm leaving it that way, I guess. */ #if !defined(DOS) && !defined(OS2) for(i = 0; i < ps_global->s_pool.nstream; i++) { m = ps_global->s_pool.streams[i]; if(m && !m->lock) pine_mail_actually_close(m); } PineRaw(0); #endif /* !DOS */ imap_flush_passwd_cache(TRUE); dprint((1, "done with fast_clean_up\n")); }