foxygit / doom Log in
commit cd71cb306fbcc89c48ede4235a20c0dd7ee03cfb
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Sat Oct 27 18:08:57 2018 -0400
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Sat Oct 27 18:08:57 2018 -0400

    glob: Fix for Watcom, too.

    Copied from src/strife/m_saves.c.
---
 src/i_glob.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/i_glob.c b/src/i_glob.c
index f508eec7..547650ee 100644
--- a/src/i_glob.c
+++ b/src/i_glob.c
@@ -22,14 +22,19 @@
 #include "m_misc.h"
 #include "config.h"

-// For Visual C++, we need to include the win_opendir module.
 #if defined(_MSC_VER)
+// For Visual C++, we need to include the win_opendir module.
 #include <win_opendir.h>
 #elif defined(HAVE_DIRENT_H)
 #include <dirent.h>
+#elif defined(__WATCOMC__)
+// Watcom has the same API in a different header.
+#include <direct.h>
+#else
+#define NO_DIRENT_IMPLEMENTATION
 #endif

-#if defined(_MSC_VER) || defined(HAVE_DIRENT_H)
+#ifndef NO_DIRENT_IMPLEMENTATION

 struct glob_s
 {
@@ -130,7 +135,7 @@ const char *I_NextGlob(glob_t *glob)
     return glob->last_filename;
 }

-#else /* #ifndef HAVE_DIRENT_H */
+#else /* #ifdef NO_DIRENT_IMPLEMENTATION */

 #warning No native implementation of file globbing.

@@ -148,5 +153,5 @@ const char *I_NextGlob(glob_t *glob)
     return "";
 }

-#endif /* #ifndef HAVE_DIRENT_H */
+#endif /* #ifdef NO_DIRENT_IMPLEMENTATION */