aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/unix.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2005-11-27 12:42:46 +0100
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2005-11-27 11:42:46 +0000
commit8824fd4cc119ccbeaab451122d5cbff6971bf958 (patch)
tree01365c36dc1d3c013aab270a069fc3359416ae3c /libgfortran/io/unix.c
parent8edbdaf7352ccfcf7a18650dca29695038d2978c (diff)
downloadgcc-8824fd4cc119ccbeaab451122d5cbff6971bf958.zip
gcc-8824fd4cc119ccbeaab451122d5cbff6971bf958.tar.gz
gcc-8824fd4cc119ccbeaab451122d5cbff6971bf958.tar.bz2
re PR libfortran/24919 ([4.0] CRLF support in libgfortran)
PR libfortran/24919 * io/list_read.c (eat_separator, finish_separator, read_character): Handle CRLF separators correctly during reads. (nml_query): Use the HAVE_CRLF macro to print adequate newlines. * io/io.h (st_parameter_dt): Add comment about the possible values for sf_seen_eor. * io/unix.c (tempfile, regular_file): HAVE_CRLF doesn't imply that O_BINARY is defined, so we add that condition. (stream_at_bof): Fix typo in comment. * io/transfer.c (read_sf): Handle correctly CRLF, setting sf_seen_eor value to 2 instead of 1. (formatted_transfer_scalar): Use the sf_seen_eor value to handle CRLF the right way. * io/write.c (nml_write_obj, namelist_write): Use CRLF as newline when HAVE_CRLF is defined. * gfortran.dg/ftell_1.f90: Modify testcase so that it doesn't fail on CRLF platforms. * gfortran.dg/ftell_2.f90: Likewise. From-SVN: r107563
Diffstat (limited to 'libgfortran/io/unix.c')
-rw-r--r--libgfortran/io/unix.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libgfortran/io/unix.c b/libgfortran/io/unix.c
index d1833f3..6750b6f 100644
--- a/libgfortran/io/unix.c
+++ b/libgfortran/io/unix.c
@@ -1037,7 +1037,7 @@ tempfile (st_parameter_open *opp)
if (mktemp (template))
do
-#ifdef HAVE_CRLF
+#if defined(HAVE_CRLF) && defined(O_BINARY)
fd = open (template, O_RDWR | O_CREAT | O_EXCL | O_BINARY,
S_IREAD | S_IWRITE);
#else
@@ -1127,7 +1127,7 @@ regular_file (st_parameter_open *opp, unit_flags *flags)
/* rwflag |= O_LARGEFILE; */
-#ifdef HAVE_CRLF
+#if defined(HAVE_CRLF) && defined(O_BINARY)
crflag |= O_BINARY;
#endif
@@ -1475,7 +1475,7 @@ stream_at_bof (stream * s)
}
-/* stream_at_eof()-- Returns nonzero if the stream is at the beginning
+/* stream_at_eof()-- Returns nonzero if the stream is at the end
* of the file. */
int