diff options
| author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-11-27 12:42:46 +0100 |
|---|---|---|
| committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-11-27 11:42:46 +0000 |
| commit | 8824fd4cc119ccbeaab451122d5cbff6971bf958 (patch) | |
| tree | 01365c36dc1d3c013aab270a069fc3359416ae3c /libgfortran/io/write.c | |
| parent | 8edbdaf7352ccfcf7a18650dca29695038d2978c (diff) | |
| download | gcc-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/write.c')
| -rw-r--r-- | libgfortran/io/write.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index fb91639..8ae2c13 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1536,7 +1536,11 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, if (obj->type != GFC_DTYPE_DERIVED) { +#ifdef HAVE_CRLF + write_character (dtp, "\r\n ", 3); +#else write_character (dtp, "\n ", 2); +#endif len = 0; if (base) { @@ -1728,7 +1732,11 @@ nml_write_obj (st_parameter_dt *dtp, namelist_info * obj, index_type offset, if (num > 5) { num = 0; +#ifdef HAVE_CRLF + write_character (dtp, "\r\n ", 3); +#else write_character (dtp, "\n ", 2); +#endif } rep_ctr = 1; } @@ -1808,7 +1816,11 @@ namelist_write (st_parameter_dt *dtp) t1 = nml_write_obj (dtp, t2, dummy_offset, dummy, dummy_name); } } +#ifdef HAVE_CRLF + write_character (dtp, " /\r\n ", 5); +#else write_character (dtp, " /\n", 4); +#endif /* Recover the original delimiter. */ |
