diff arogue5/mdport.c @ 122:65f3da34578a

rogue4, arogue5: improve portability. Most changes merely prevent including header files that don't exist. All games now build and run on MinGW, though bugs remain.
author John "Elwin" Edwards
date Wed, 07 May 2014 14:08:38 -0700
parents 2f41b9635c34
children aac28331e71d
line wrap: on
line diff
--- a/arogue5/mdport.c	Sat May 03 10:31:30 2014 -0700
+++ b/arogue5/mdport.c	Wed May 07 14:08:38 2014 -0700
@@ -42,9 +42,15 @@
 #undef MOUSE_MOVED
 #elif defined(__DJGPP__)
 #include <process.h>
-#else
+#endif
+
+#ifdef HAVE_PWD_H
 #include <pwd.h>
+#endif
+#ifdef HAVE_SYS_UTSNAME_H
 #include <sys/utsname.h>
+#endif
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
@@ -57,12 +63,10 @@
 
 #include <curses.h>
 
-#if defined(__INTERIX) || defined(__MSYS__)
+#if defined(HAVE_TERM_H)
 #include <term.h>
 #elif defined(HAVE_NCURSES_TERM_H)
 #include <ncurses/term.h>
-#else
-#include <term.h>
 #endif
 
 #include <stdio.h>
@@ -93,14 +97,20 @@
 }
 
 int
-md_hasclreol()
+md_hasclreol(void)
 {
-#ifndef	attron
-    return(!CE);
-#elif !defined(__PDCURSES__)
-    return(clr_eol != NULL);
+#if defined(clr_eol)
+#ifdef NCURSES_VERSION
+    if (cur_term == NULL)
+	return(0);
+    if (cur_term->type.Strings == NULL)
+	return(0);
+#endif
+    return((clr_eol != NULL) && (*clr_eol != 0));
+#elif defined(__PDCURSES__)
+    return(TRUE);
 #else
-    return(TRUE);
+    return((CE != NULL) && (*CE != 0));
 #endif
 }