]> granicus.if.org Git - nethack/commitdiff
build fix for files.c
authornethack.allison <nethack.allison>
Tue, 23 Jul 2002 04:51:28 +0000 (04:51 +0000)
committernethack.allison <nethack.allison>
Tue, 23 Jul 2002 04:51:28 +0000 (04:51 +0000)
Warwick's plname files.c addition broke the
build on both win32 and CE because NAMES_MAX
wasn't defined.

In win32 it was defined in limits.h, but only
when _POSIX_ was defined.

In CE it just didn't exist in any of the
header files.  Since it was also complaining
about strdup(), I #ifdef'd Warwick's code out
under CE.

src/files.c

index 507dc8eed516ebcf91b35808b4f25f69fb07a38d..5e10073539446f000d5850dd9b5dcbefb7662f37 100644 (file)
@@ -42,6 +42,12 @@ extern int errno;
 # define O_BINARY 0
 #endif
 
+#if defined(WIN32)
+#define _POSIX_
+#include <limits.h>
+#undef _POSIX_
+#endif
+
 #ifdef PREFIXES_IN_USE
 #define FQN_NUMBUF 4
 static char fqn_filename_buffer[FQN_NUMBUF][FQN_MAX_FILENAME];
@@ -808,6 +814,8 @@ restore_saved_game()
        return fd;
 }
 
+#if !defined(WIN_CE)
+
 static char*
 plname_from_file(filename)
 const char* filename;
@@ -901,6 +909,7 @@ char** saved;
     }
 }
 
+#endif /* !WIN_CE */
 
 /* ----------  END SAVE FILE HANDLING ----------- */