wilcoxon: Drop now-unnecessary timer support.
[pspp-builds.git] / src / ui / gui / psppire.c
index b1551fbb15f137f81cc548cc48f3f49a80f70fb3..9dd3b71372f6334fea60115c325aa35724353f06 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2004, 2005, 2006  Free Software Foundation
+   Copyright (C) 2004, 2005, 2006, 2009  Free Software Foundation
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -20,7 +20,6 @@
 #include <assert.h>
 #include <libintl.h>
 #include <gsl/gsl_errno.h>
-#include <signal.h>
 
 #include <argp.h>
 #include <ui/command-line.h>
@@ -72,9 +71,7 @@ struct dataset * the_dataset = NULL;
 static void
 replace_casereader (struct casereader *s)
 {
-  PsppireCaseFile *pcf = psppire_case_file_new (s);
-
-  psppire_data_store_set_case_file (the_data_store, pcf);
+  psppire_data_store_set_reader (the_data_store, s);
 }
 
 #define _(msgid) gettext (msgid)
@@ -123,20 +120,29 @@ initialize (struct command_line_processor *clp, int argc, char **argv)
 
   create_icon_factory ();
 
-  outp_configure_driver_line (
-    ss_cstr ("gui:ascii:screen:squeeze=on headers=off top-margin=0 "
-             "bottom-margin=0 paginate=off length=auto width=auto "
-            "emphasis=none "
-             "output-file=\"" OUTPUT_FILE_NAME "\" append=yes"));
+  {
+    const char *filename = output_file_name ();
+
+    struct string config_string;
+
+    ds_init_empty (&config_string);
+
+    ds_put_format (&config_string,
+                  "gui:ascii:screen:squeeze=on headers=off top-margin=0 "
+                  "bottom-margin=0 paginate=off length=auto width=auto "
+                  "emphasis=none "
+                  "output-file=\"%s\" append=yes", filename);
+
+    outp_configure_driver_line (ds_ss (&config_string));
+
+    unlink (filename);
 
-  unlink (OUTPUT_FILE_NAME);
+    ds_destroy (&config_string);
+  }
 
   journal_enable ();
   textdomain (PACKAGE);
 
-  /* Ignore alarm clock signals */
-  signal (SIGALRM, SIG_IGN);
-
   command_line_processor_replace_aux (clp, &post_init_argp, the_source_stream);
   command_line_processor_replace_aux (clp, &non_option_argp, the_source_stream);
 
@@ -263,7 +269,13 @@ parse_non_options (int key, char *arg, struct argp_state *state)
        if (pfm_detect (fp))
          {
            ds_init_cstr (&syntax, "IMPORT FILE=");
+           goto close;
          }
+
+       fclose (fp);
+       msg (ME, _("%s is neither a system nor portable file"), arg);
+       break;
+
       close:
        fclose (fp);