--- unix.c~ 2006-02-14 20:21:14.000000000 +0000 +++ unix.c 2006-02-20 20:09:54.000000000 +0000 @@ -81,6 +81,10 @@ #define S_IWOTH 0 #endif +#ifdef __DJGPP__ +#include +#endif + /* This implementation of stream I/O is based on the paper: * * "Exploiting the advantages of mapped files for stream I/O", @@ -1072,7 +1076,12 @@ template = get_mem (strlen (tempdir) + 20); +#ifdef __DJGPP__ + /* Default filename is too long for DOS */ + st_sprintf (template, "%s/gfXXXXXX", tempdir); +#else st_sprintf (template, "%s/gfortrantmpXXXXXX", tempdir); +#endif #ifdef HAVE_MKSTEMP @@ -1263,6 +1272,13 @@ internal_error (&opp->common, "open_external(): Bad action"); } +#ifdef __DJGPP__ + if (flags->form == FORM_UNFORMATTED) + { + setmode (fd, O_BINARY); + } +#endif + return fd_to_stream (fd, prot); }