Sat Dec 27 16:16:49 2003 Ben Pfaff <blp@gnu.org>
[pspp-builds.git] / src / main.c
index e25991862f7301b2e90e2bf5df0fc84093f648c4..e0cd4f3e4fac1678d37483628f6e3c778ce7de01 100644 (file)
    02111-1307, USA. */
 
 #include <config.h>
+#include "main.h"
 #include <assert.h>
 #include <stdio.h>
+#include "cmdline.h"
 #include "command.h"
 #include "error.h"
 #include "getline.h"
+#include "glob.h"
 #include "lexer.h"
 #include "output.h"
 
 #include <stdlib.h>
 
-#undef DEBUGGING
-/*#define DEBUGGING 1*/
 #include "debug-print.h"
 
 static void parse_script (void) __attribute__ ((noreturn));
@@ -53,9 +54,6 @@ int start_interactive;
 int
 main (int argc, char **argv)
 {
-  void init_glob (int, char **);       /* Exported by glob.c. */
-  void parse_command_line (int, char **);      /* Exported by cmdline.c */
-
   /* Initialization. */
   if (!outp_init ())
     err_hcf (0);
@@ -69,6 +67,9 @@ main (int argc, char **argv)
 
   /* Execution. */
   parse_script ();
+
+  /* Should never be reached */
+  return (-1);
 }
 
 /* Parses the entire script. */
@@ -81,7 +82,7 @@ parse_script (void)
       handle_error (execute_command ());
     }
 
-  err_hcf (1);
+  err_hcf (err_error_count==0);
 }
 
 /* Parse and execute a command, returning its return code. */
@@ -101,7 +102,7 @@ execute_command (void)
        break;
 
       if (!getl_perform_delayed_reset ())
-       err_hcf (1);
+       err_hcf (err_error_count==0);
     }
 
   /* Parse the command. */