From 8824fd4cc119ccbeaab451122d5cbff6971bf958 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Sun, 27 Nov 2005 12:42:46 +0100 Subject: 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 --- libgfortran/io/unix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libgfortran/io/unix.c') 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 -- cgit v1.1