From: Ben Pfaff Date: Tue, 25 Apr 2006 16:41:33 +0000 (+0000) Subject: * main.c: (terminate) Mark static and NO_RETURN. If called X-Git-Tag: v0.6.0~954 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe78c02ffbbf5e26593b48e47600c4ca86af681c;p=pspp-builds.git * main.c: (terminate) Mark static and NO_RETURN. If called recursively, which can only happen via signal, just exit instead of trying to gracefully shut down. --- diff --git a/src/ui/terminal/ChangeLog b/src/ui/terminal/ChangeLog index 9d35ada8..33b46549 100644 --- a/src/ui/terminal/ChangeLog +++ b/src/ui/terminal/ChangeLog @@ -1,3 +1,9 @@ +Tue Apr 25 09:39:46 2006 Ben Pfaff + + * main.c: (terminate) Mark static and NO_RETURN. If called + recursively, which can only happen via signal, just exit instead + of trying to gracefully shut down. + Fri Mar 31 10:33:37 2006 Ben Pfaff * command-line.c: (var pre_syntax_message) -d and -u are no longer diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c index e66035d4..14677ada 100644 --- a/src/ui/terminal/main.c +++ b/src/ui/terminal/main.c @@ -59,6 +59,7 @@ static void i18n_init (void); static void fpu_init (void); static void handle_error (int code); static int execute_command (void); +static void terminate (bool success) NO_RETURN; /* If a segfault happens, issue a message to that effect and halt */ void bug_handler(int sig); @@ -66,7 +67,6 @@ void bug_handler(int sig); /* Handle quit/term/int signals */ void interrupt_handler(int sig); -void terminate (bool success); /* Program entry point. */ int @@ -111,7 +111,6 @@ main (int argc, char **argv) } terminate (err_error_count == 0); - abort (); } /* Parse and execute a command, returning its return code. */ @@ -245,25 +244,26 @@ interrupt_handler(int sig UNUSED) /* Terminate PSPP. SUCCESS should be true to exit successfully, false to exit as a failure. */ -void +static void terminate (bool success) { static bool terminating = false; - if (terminating) - return; - terminating = true; - - msg_done (); - outp_done (); + if (!terminating) + { + terminating = true; - cancel_transformations (); - dict_destroy (default_dict); + msg_done (); + outp_done (); - random_done (); - settings_done (); - fh_done (); - lex_done (); - getl_uninitialize (); + cancel_transformations (); + dict_destroy (default_dict); + random_done (); + settings_done (); + fh_done (); + lex_done (); + getl_uninitialize (); + readln_uninitialize (); + } exit (success ? EXIT_SUCCESS : EXIT_FAILURE); }