# HG changeset patch # User John "Elwin" Edwards # Date 1514388366 18000 # Node ID 5b6855d5d089cc3454c9c2ad457a3d340c7e075f # Parent 2b452dbf01382d2a163912e4611489006d9f9f65 Fix a portability issue with md_hasclreol(). Some games' implementation of md_hasclreol() poked around in ncurses internals, which does not work for some ncurses build configuration. Most games did not actually call md_hasclreol(), so it was removed. There is a standard terminfo function which can retrieve the value of the clr_eol capability, so this was used for rogue5. diff -r 2b452dbf0138 -r 5b6855d5d089 arogue5/mdport.c --- a/arogue5/mdport.c Sun Nov 26 11:34:45 2017 -0500 +++ b/arogue5/mdport.c Wed Dec 27 10:26:06 2017 -0500 @@ -106,24 +106,6 @@ #endif } -int -md_hasclreol(void) -{ -#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((CE != NULL) && (*CE != 0)); -#endif -} - #ifdef attron # define _puts(s) tputs(s, 0, putchar); # define SO enter_standout_mode diff -r 2b452dbf0138 -r 5b6855d5d089 rogue3/mdport.c --- a/rogue3/mdport.c Sun Nov 26 11:34:45 2017 -0500 +++ b/rogue3/mdport.c Wed Dec 27 10:26:06 2017 -0500 @@ -264,24 +264,6 @@ #endif } -int -md_hasclreol(void) -{ -#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((CE != NULL) && (*CE != 0)); -#endif -} - #ifdef _WIN32 static int md_standout_mode = 0; #endif diff -r 2b452dbf0138 -r 5b6855d5d089 rogue3/mdport.h --- a/rogue3/mdport.h Sun Nov 26 11:34:45 2017 -0500 +++ b/rogue3/mdport.h Wed Dec 27 10:26:06 2017 -0500 @@ -171,7 +171,6 @@ int md_shellescape(void); void md_sleep(int s); int md_suspchar(void); -int md_hasclreol(void); int md_unlink(char *file); int md_unlink_open_file(const char *file, FILE *inf); void md_tstpsignal(void); diff -r 2b452dbf0138 -r 5b6855d5d089 rogue4/mdport.c --- a/rogue4/mdport.c Sun Nov 26 11:34:45 2017 -0500 +++ b/rogue4/mdport.c Wed Dec 27 10:26:06 2017 -0500 @@ -110,20 +110,6 @@ #endif } -int -md_hasclreol(void) -{ -#ifdef CE - return((CE != NULL) && (*CE != 0)); -#elif defined (clr_eol) - return((clr_eol != NULL) && (*clr_eol != 0)); -#elif !defined(__PDCURSES__) - return(clr_eol != NULL); -#else - return(TRUE); -#endif -} - static int md_standout_mode = 0; void diff -r 2b452dbf0138 -r 5b6855d5d089 rogue5/mdport.c --- a/rogue5/mdport.c Sun Nov 26 11:34:45 2017 -0500 +++ b/rogue5/mdport.c Wed Dec 27 10:26:06 2017 -0500 @@ -263,13 +263,13 @@ int md_hasclreol(void) { -#if defined(clr_eol) #ifdef NCURSES_VERSION + char *cap_str; if (cur_term == NULL) return(0); - if (cur_term->type.Strings == NULL) - return(0); -#endif + cap_str = tigetstr("el"); + return (cap_str != NULL); +#elif defined(clr_eol) return((clr_eol != NULL) && (*clr_eol != 0)); #elif defined(__PDCURSES__) return(TRUE); diff -r 2b452dbf0138 -r 5b6855d5d089 srogue/mdport.c --- a/srogue/mdport.c Sun Nov 26 11:34:45 2017 -0500 +++ b/srogue/mdport.c Wed Dec 27 10:26:06 2017 -0500 @@ -260,24 +260,6 @@ #endif } -int -md_hasclreol(void) -{ -#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((CE != NULL) && (*CE != 0)); -#endif -} - #ifdef _WIN32 static int md_standout_mode = 0; #endif diff -r 2b452dbf0138 -r 5b6855d5d089 srogue/rogue.h --- a/srogue/rogue.h Sun Nov 26 11:34:45 2017 -0500 +++ b/srogue/rogue.h Wed Dec 27 10:26:06 2017 -0500 @@ -67,7 +67,6 @@ int md_shellescape(void); void md_sleep(int s); int md_suspchar(void); -int md_hasclreol(void); int md_unlink(char *file); int md_unlink_open_file(const char *file, FILE *inf); void md_tstpsignal(void); diff -r 2b452dbf0138 -r 5b6855d5d089 urogue/mdport.c --- a/urogue/mdport.c Sun Nov 26 11:34:45 2017 -0500 +++ b/urogue/mdport.c Wed Dec 27 10:26:06 2017 -0500 @@ -103,18 +103,6 @@ #endif } -int -md_hasclreol() -{ -#ifndef attron - return(!CE); -#elif !defined(__PDCURSES__) - return(clr_eol != NULL); -#else - return(TRUE); -#endif -} - #ifdef attron # define _puts(s) tputs(s, 0, putchar); # define SO enter_standout_mode