Adopt use of gnulib for portability.
[pspp-builds.git] / src / dfm-read.c
index 32b458e00f64be9f2b0255e38c2a9a510f6688d6..2f17d41980fcdc04329e74e8fcafbd8af042e66f 100644 (file)
 #include "error.h"
 #include "file-handle.h"
 #include "filename.h"
-#include "getline.h"
+#include "getl.h"
 #include "lexer.h"
 #include "str.h"
 #include "vfm.h"
 
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
 #include "debug-print.h"
 
 /* Flags for DFM readers. */
@@ -78,11 +81,12 @@ dfm_close_reader (struct dfm_reader *r)
       assert (inline_open_cnt > 0);
       still_open = --inline_open_cnt;
 
-      if (still_open) 
+      if (!still_open) 
         {
           /* Skip any remaining data on the inline file. */
-          while ((r->flags & DFM_EOF) == 0)
-            read_record (r);
+          if (r->flags & DFM_SAW_BEGIN_DATA)
+            while ((r->flags & DFM_EOF) == 0)
+              read_record (r);
           inline_file = NULL;
         }
     }