Merge commit 'origin/stable'
[pspp-builds.git] / src / ui / gui / psppire.c
index b1551fbb15f137f81cc548cc48f3f49a80f70fb3..2918238c419b2c23173edfad68b2a5d28aa75847 100644 (file)
@@ -72,9 +72,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,13 +121,25 @@ 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);
 
-  unlink (OUTPUT_FILE_NAME);
+    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);
+
+    ds_destroy (&config_string);
+  }
 
   journal_enable ();
   textdomain (PACKAGE);
@@ -263,7 +273,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);