FILE HANDLE: Use system native line ends by default. 20130322030508/pspp
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 22 Mar 2013 04:42:23 +0000 (21:42 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 22 Mar 2013 04:42:23 +0000 (21:42 -0700)
Requested by Ronald Crichton.

NEWS
doc/data-io.texi
src/data/file-handle-def.c

diff --git a/NEWS b/NEWS
index 7b20d4e9f78be094f542cf13dfbc93bc477e3261..bf043140e13df834f407c9caffd5ca2648a52a19 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -136,6 +136,10 @@ Changes from 0.6.2 to 0.7.9:
    See the documentation for the INSERT command in the PSPP manual for
    more information.
 
+ * Text data files that PRINT and WRITE creates now use the system
+   native line ends by default (CRLF on Windows, LF only elsewhere).
+   Use the new ENDS subcommand on FILE HANDLE to override the default.
+
  * A new Perl module allows Perl programs to read and write PSPP
    system files.
 
index 79deb4a3ac6a79cea71707e3791b19af71442797..313e543205a41f430ac864534ce22a132bfabecd 100644 (file)
@@ -629,10 +629,11 @@ Each tab is 4 characters wide by default, but TABWIDTH (a @pspp{}
 extension) may be used to specify an alternate width.  Use a TABWIDTH
 of 0 to suppress tab expansion.
 
-By default, a file written in CHARACTER mode uses line feeds only at
-ends of lines, which is customary on Unix-like system.  Specify ENDS
-as CR or CRLF to override the default.  PSPP reads files using either
-convention on any kind of system, regardless of ENDS.
+A file written in CHARACTER mode by default uses the line ends of the
+system on which PSPP is running, that is, on Windows, the default is
+CR LF line ends, and on other systems the default is LF only.  Specify
+ENDS as CR or CRLF to override the default.  PSPP reads files using
+either convention on any kind of system, regardless of ENDS.
 
 @item
 In IMAGE mode, the data file is treated as a series of fixed-length
index 78848c20191a720c9882476b220d027f917b1722..9c853e5e983d7968bf427e0a01765680c1cec0e0 100644 (file)
@@ -265,8 +265,14 @@ fh_create_dataset (struct dataset *ds)
 const struct fh_properties *
 fh_default_properties (void)
 {
+#if defined _WIN32 || defined __WIN32__
+#define DEFAULT_LINE_ENDS FH_END_CRLF
+#else
+#define DEFAULT_LINE_ENDS FH_END_LF
+#endif
+
   static const struct fh_properties default_properties
-    = {FH_MODE_TEXT, FH_END_LF, 1024, 4, (char *) "Auto"};
+    = {FH_MODE_TEXT, DEFAULT_LINE_ENDS, 1024, 4, (char *) "Auto"};
   return &default_properties;
 }