X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fterminal%2Fmain.c;h=8ed050778fdcec6e870e0d243ccd6b39e7859d9c;hb=f5c108becd49d78f4898cab11352291f5689d24e;hp=81b09a1df24d22120d270fb0b5bd97bc2a2eff4f;hpb=ecd26ec19e9f8a58079a1c5fa06b39484787ab7e;p=pspp diff --git a/src/ui/terminal/main.c b/src/ui/terminal/main.c index 81b09a1df2..8ed050778f 100644 --- a/src/ui/terminal/main.c +++ b/src/ui/terminal/main.c @@ -27,7 +27,6 @@ #include "progname.h" #include "read-line.h" -#include #include #include #include @@ -58,6 +57,10 @@ #include #endif +#if HAVE_IEEEFP_H +#include +#endif + #include "gettext.h" #define _(msgid) gettext (msgid) @@ -82,13 +85,13 @@ static struct source_stream *the_source_stream ; int main (int argc, char **argv) { - struct casefile_factory *factory; signal (SIGABRT, bug_handler); signal (SIGSEGV, bug_handler); signal (SIGFPE, bug_handler); signal (SIGINT, interrupt_handler); - set_program_name ("pspp"); + set_program_name (argv[0]); + i18n_init (); fpu_init (); gsl_set_error_handler_off (); @@ -106,9 +109,7 @@ main (int argc, char **argv) settings_init (); random_init (); - factory = fastfile_factory_create (); - - the_dataset = create_dataset (factory, NULL, NULL); + the_dataset = create_dataset (NULL, NULL); if (parse_command_line (argc, argv, the_source_stream)) { @@ -118,9 +119,8 @@ main (int argc, char **argv) for (;;) { - int result = cmd_parse (the_lexer, the_dataset, - proc_has_source (the_dataset) - ? CMD_STATE_DATA : CMD_STATE_INITIAL); + int result = cmd_parse (the_lexer, the_dataset); + if (result == CMD_EOF || result == CMD_FINISH) break; if (result == CMD_CASCADING_FAILURE && @@ -128,7 +128,7 @@ main (int argc, char **argv) { msg (SE, _("Stopping syntax file processing here to avoid " "a cascade of dependent command failures.")); - getl_abort_noninteractive (the_source_stream); + getl_abort_noninteractive (the_source_stream); } else check_msg_count (the_source_stream); @@ -139,7 +139,7 @@ main (int argc, char **argv) } static void -i18n_init (void) +i18n_init (void) { #if ENABLE_NLS #if HAVE_LC_MESSAGES @@ -152,24 +152,26 @@ i18n_init (void) } static void -fpu_init (void) +fpu_init (void) { #if HAVE_FEHOLDEXCEPT fenv_t foo; feholdexcept (&foo); #elif HAVE___SETFPUCW && defined(_FPU_IEEE) __setfpucw (_FPU_IEEE); +#elif HAVE_FPSETMASK + fpsetmask (0); #endif } /* If a segfault happens, issue a message to that effect and halt */ -void +void bug_handler(int sig) { #if DEBUGGING connect_debugger (); #endif - switch (sig) + switch (sig) { case SIGABRT: request_bug_report_and_abort("Assertion Failure/Abort"); @@ -182,7 +184,7 @@ bug_handler(int sig) } } -void +void interrupt_handler(int sig UNUSED) { terminate (false); @@ -195,7 +197,7 @@ static void terminate (bool success) { static bool terminating = false; - if (!terminating) + if (!terminating) { terminating = true;