Mercurial > hg > early-roguelike
comparison rogue4/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 | ba9930a7f99d |
children | 600873555ec0 |
comparison
equal
deleted
inserted
replaced
121:e6c8652473fe | 122:65f3da34578a |
---|---|
27 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 27 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
28 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 28 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
29 SUCH DAMAGE. | 29 SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #ifdef HAVE_CONFIG_H | |
33 #include "config.h" | |
34 #endif | |
35 | |
32 #if defined(_WIN32) | 36 #if defined(_WIN32) |
33 #include <Windows.h> | 37 #include <Windows.h> |
34 #include <Lmcons.h> | 38 #include <Lmcons.h> |
35 #include <process.h> | 39 #include <process.h> |
36 #include <shlobj.h> | 40 #include <shlobj.h> |
38 #include <io.h> | 42 #include <io.h> |
39 #include <conio.h> | 43 #include <conio.h> |
40 #undef MOUSE_MOVED | 44 #undef MOUSE_MOVED |
41 #elif defined(__DJGPP__) | 45 #elif defined(__DJGPP__) |
42 #include <process.h> | 46 #include <process.h> |
43 #else | 47 #endif |
48 | |
49 #ifdef HAVE_PWD_H | |
44 #include <pwd.h> | 50 #include <pwd.h> |
45 #include <sys/utsname.h> | 51 #endif |
52 #ifdef HAVE_UNISTD_H | |
46 #include <unistd.h> | 53 #include <unistd.h> |
54 #endif | |
55 #ifdef HAVE_UTMPX_H | |
47 #include <utmpx.h> | 56 #include <utmpx.h> |
48 #endif | 57 #endif |
49 | 58 |
50 #ifdef __INTERIX | 59 #ifdef __INTERIX |
51 char *strdup(const char *s); | 60 char *strdup(const char *s); |
58 #if defined(_WIN32) && !defined(__MINGW32__) | 67 #if defined(_WIN32) && !defined(__MINGW32__) |
59 #define PATH_MAX MAX_PATH | 68 #define PATH_MAX MAX_PATH |
60 #endif | 69 #endif |
61 | 70 |
62 #include <curses.h> | 71 #include <curses.h> |
63 #if !defined(DJGPP) | 72 #ifdef HAVE_TERM_H |
64 #include <term.h> | 73 #include <term.h> |
65 #endif | 74 #endif |
66 | 75 |
67 #include <stdio.h> | 76 #include <stdio.h> |
68 #include <fcntl.h> | 77 #include <fcntl.h> |
655 #else | 664 #else |
656 return( (long)sbrk(0) ); | 665 return( (long)sbrk(0) ); |
657 #endif | 666 #endif |
658 } | 667 } |
659 | 668 |
660 char * | |
661 md_gethostname() | |
662 { | |
663 static char nodename[80]; | |
664 char *n = NULL; | |
665 #if !defined(_WIN32) && !defined(__DJGPP__) | |
666 struct utsname ourname; | |
667 | |
668 if (uname(&ourname) == 0) | |
669 n = ourname.nodename; | |
670 #endif | |
671 if ((n == NULL) || (*n == '\0')) | |
672 if ( (n = getenv("COMPUTERNAME")) == NULL) | |
673 if ( (n = getenv("HOSTNAME")) == NULL) | |
674 n = "localhost"; | |
675 | |
676 strncpy(nodename, n, 80); | |
677 nodename[79] = 0; | |
678 | |
679 return(nodename); | |
680 } | |
681 | |
682 int | 669 int |
683 md_erasechar() | 670 md_erasechar() |
684 { | 671 { |
685 #ifdef BSD | 672 #ifdef BSD |
686 return(_tty.sg_erase); /* process erase character */ | 673 return(_tty.sg_erase); /* process erase character */ |