/* nap_exit: cleans up and leaves */ void nap_exit (int really_quit, char *reason, char *format, ...) { if (dead == 1) { kill_all_threads(); exit(1); } else if (dead == 2) { kill_all_threads(); _exit(1); } else if (dead == 3) { kill_all_threads(); kill(getpid(), SIGKILL); } dead++; set_lastlog_size(NULL, NULL, 0); set_history_size(NULL, NULL, 0); if (really_quit) { kill_all_threads(); say("Signon time : %s", my_ctime(start_time)); say("Signoff time : %s", my_ctime(now)); say("Total uptime : %s", convert_time(now - start_time)); } do_hook(EXIT_LIST, "%s", reason ? reason : empty_string); if (reason) say("%s", reason); close_all_servers(); close_all_sockets(); if (term_initialized) { cursor_to_input(); term_cr(); term_clear_to_eol(); term_reset(); } remove_bindings(); clear_variables(); delete_all_windows(); destroy_call_stack(); write_unfinished_list(); debug_cleanup(); fprintf(stdout, "\r"); fflush(stdout); if (really_quit) exit(0); kill_all_threads(); my_signal(SIGABRT, SIG_DFL, 0); kill(getpid(), SIGABRT); kill(getpid(), SIGQUIT); exit(1); }
/* irc_exit: cleans up and leaves */ void BX_irc_exit (int really_quit, char *reason, char *format, ...) { char buffer[BIG_BUFFER_SIZE]; logger(current_window, NULL, 0); if (get_int_var(MSGLOG_VAR)) log_toggle(0, NULL); if (format) { va_list arglist; va_start(arglist, format); vsprintf(buffer, format, arglist); va_end(arglist); } else sprintf(buffer, "%s -- just do it.",irc_version); if (really_quit) { put_it("%s", convert_output_format("$G Signon time : $0-", "%s", my_ctime(start_time))); put_it("%s", convert_output_format("$G Signoff time : $0-", "%s", my_ctime(now))); put_it("%s", convert_output_format("$G Total uptime : $0-", "%s", convert_time(now - start_time))); } do_hook(EXIT_LIST, "%s", reason ? reason : buffer); close_all_servers(reason ? reason : buffer); put_it("%s", buffer ? buffer : reason ? reason : empty_string); clean_up_processes(); if (!dumb_mode && term_initialized) { cursor_to_input(); /* Needed so that ircII doesn't gobble * the last line of the kill. */ term_cr(); term_clear_to_eol(); term_reset(); } destroy_call_stack(); #if defined(THREAD) && defined(WANT_NSLOOKUP) kill_dns(); #endif remove_pid(); if (really_quit) { #ifdef GUI gui_exit(); #else #if defined(WANT_DETACH) && !defined(GUI) kill_attached_if_needed(0); #endif fprintf(stdout, "\r"); fflush(stdout); exit(0); #endif } }