changeset 196:80a590e67206

Advanced Rogue 5: add and use md_fdopen(). Portability is improved.
author John "Elwin" Edwards
date Tue, 11 Aug 2015 15:15:09 -0400
parents beab22b087a1
children 61d1c9ac9be7
files arogue5/mdport.c arogue5/rip.c arogue5/rogue.h
diffstat 3 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/arogue5/mdport.c	Tue Aug 11 13:13:08 2015 -0400
+++ b/arogue5/mdport.c	Tue Aug 11 15:15:09 2015 -0400
@@ -209,6 +209,15 @@
     return(fd);
 }
 
+FILE *
+md_fdopen(int fd, char *mode)
+{
+#ifdef _WIN32
+    return( _fdopen(fd, mode) );
+#else
+    return( fdopen(fd, mode) );
+#endif
+}
 
 int
 md_normaluser()
--- a/arogue5/rip.c	Tue Aug 11 13:13:08 2015 -0400
+++ b/arogue5/rip.c	Tue Aug 11 15:15:09 2015 -0400
@@ -209,7 +209,7 @@
        printf("\nCannot open score_file.\n");
        return;
     }
-    outf = (FILE *) fdopen(fd, "w");
+    outf = (FILE *) md_fdopen(fd, "w");
 
     /* Get this system's name */
     thissys = md_gethostname();
--- a/arogue5/rogue.h	Tue Aug 11 13:13:08 2015 -0400
+++ b/arogue5/rogue.h	Tue Aug 11 15:15:09 2015 -0400
@@ -983,6 +983,7 @@
 extern char *md_crypt();
 extern char *md_getroguedir();
 extern void md_init();
+extern FILE * md_fdopen(int fd, char *mode);
 
 /*
  * Now all the global variables