comparison rogue3/mdport.h @ 0:527e2150eaf0

Import Rogue 3.6 from the Roguelike Restoration Project (r1490)
author edwarj4
date Tue, 13 Oct 2009 13:33:34 +0000
parents
children 12e070d1a780
comparison
equal deleted inserted replaced
-1:000000000000 0:527e2150eaf0
1 /*
2 mdport.h - Machine Dependent Code for Porting Unix/Curses games
3
4 Copyright (C) 2008 Nicholas J. Kisseberth
5 All rights reserved.
6
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
9 are met:
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3. Neither the name(s) of the author(s) nor the names of other contributors
16 may be used to endorse or promote products derived from this software
17 without specific prior written permission.
18
19 THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTORS ``AS IS'' AND
20 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTORS BE LIABLE
23 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
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
29 SUCH DAMAGE.
30 */
31
32 #ifdef HAVE_CONFIG_H
33 #ifdef PDCURSES
34 #undef HAVE_UNISTD_H
35 #undef HAVE_LIMITS_H
36 #undef HAVE_MEMORY_H
37 #undef HAVE_STRING_H
38 #endif
39 #include "config.h"
40
41 #elif defined(__DJGPP__)
42 #define HAVE_SYS_TYPES_H 1
43 #define HAVE_PROCESS_H 1
44 #define HAVE_PWD_H 1
45 #define HAVE_TERMIOS_H 1
46 #define HAVE_SETGID 1
47 #define HAVE_GETGID 1
48 #define HAVE_SETUID 1
49 #define HAVE_GETUID 1
50 #define HAVE_GETPASS 1
51 #define HAVE_SPAWNL 1
52 #define HAVE_ALARM 1
53 #define HAVE_ERASECHAR 1
54 #define HAVE_KILLCHAR 1
55 #define HAVE_CRYPT
56
57 #elif defined(_WIN32)
58 #define HAVE_CURSES_H
59 #define HAVE_TERM_H
60 #define HAVE__SPAWNL
61 #define HAVE_SYS_TYPES_H
62 #define HAVE_PROCESS_H
63 #define HAVE_ERASECHAR 1
64 #define HAVE_KILLCHAR 1
65 #ifndef uid_t
66 typedef unsigned int uid_t;
67 #endif
68 #ifndef pid_t
69 typedef unsigned int pid_t;
70 #endif
71
72 #elif defined(__CYGWIN__)
73 #define HAVE_SYS_TYPES_H 1
74 #define HAVE_PWD_H 1
75 #define HAVE_PWD_H 1
76 #define HAVE_SYS_UTSNAME_H 1
77 #define HAVE_ARPA_INET_H 1
78 #define HAVE_UNISTD_H 1
79 #define HAVE_TERMIOS_H 1
80 #define HAVE_NCURSES_TERM_H 1
81 #define HAVE_ESCDELAY
82 #define HAVE_SETGID 1
83 #define HAVE_GETGID 1
84 #define HAVE_SETUID 1
85 #define HAVE_GETUID 1
86 #define HAVE_GETPASS 1
87 #define HAVE_GETPWUID 1
88 #define HAVE_WORKING_FORK 1
89 #define HAVE_ALARM 1
90 #define HAVE_SPAWNL 1
91 #define HAVE__SPAWNL 1
92 #define HAVE_ERASECHAR 1
93 #define HAVE_KILLCHAR 1
94 #define HAVE_CRYPT 1
95
96 #else /* standards based unix */
97 #define HAVE_SYS_TYPES_H 1
98 #define HAVE_PWD_H 1
99 #define HAVE_SYS_UTSNAME_H 1
100 #define HAVE_ARPA_INET_H 1
101 #define HAVE_UNISTD_H 1
102 #define HAVE_CRYPT_H 1
103 #define HAVE_LIMITS_H 1
104 #define HAVE_TERMIOS_H 1
105 #define HAVE_UTMPX_H 1
106 #define HAVE_ERRNO_H 1
107 #define HAVE_TERM_H 1
108 #define HAVE_SETGID 1
109 #define HAVE_GETGID 1
110 #define HAVE_SETUID 1
111 #define HAVE_GETUID 1
112 #define HAVE_SETREUID 1
113 #define HAVE_SETREGID 1
114 #define HAVE_CRYPT 1
115 #define HAVE_GETPASS 1
116 #define HAVE_GETPWUID 1
117 #define HAVE_WORKING_FORK 1
118 #define HAVE_ERASECHAR 1
119 #define HAVE_KILLCHAR 1
120 #ifndef _AIX
121 #define HAVE_GETLOADAVG 1
122 #endif
123 #define HAVE_ALARM 1
124 #endif
125
126 #ifdef __DJGPP__
127 #undef HAVE_GETPWUID /* DJGPP's limited version doesn't even work as documented */
128 #endif
129
130 #define MD_STRIP_CTRL_KEYPAD 1
131
132 #ifdef HAVE_SYS_TYPES_H
133 #include <sys/types.h>
134 #endif
135
136 #ifdef HAVE_LIMITS_H
137 #include <limits.h>
138 #endif
139
140 #if !defined(PATH_MAX) && defined(_MAX_PATH)
141 #define PATH_MAX _MAX_PATH
142 #endif
143
144 #if !defined(PATH_MAX) && defined(_PATH_MAX)
145 #define PATH_MAX _PATH_MAX
146 #endif
147
148 #ifndef HAVE_CRYPT
149 char * crypt(const char *key, const char *setting);
150 #else
151 #ifdef HAVE_UNISTD_H
152 #include <unistd.h>
153 #endif
154 #ifdef HAVE_CRYPT_H
155 #include <crypt.h>
156 #endif
157 #endif
158
159 int md_chmod(const char *filename, int mode);
160 int md_dsuspchar(void);
161 int md_erasechar(void);
162 char * md_gethomedir(void);
163 char * md_getusername(void);
164 uid_t md_getuid(void);
165 char * md_getpass(char *prompt);
166 pid_t md_getpid(void);
167 char * md_getrealname(uid_t uid);
168 void md_init(int options);
169 int md_killchar(void);
170 void md_normaluser(void);
171 void md_raw_standout(void);
172 void md_raw_standend(void);
173 int md_readchar(WINDOW *win);
174 int md_setdsuspchar(int c);
175 int md_shellescape(void);
176 void md_sleep(int s);
177 int md_suspchar(void);
178 int md_hasclreol(void);
179 int md_unlink(char *file);
180 int md_unlink_open_file(const char *file, FILE *inf);
181 void md_tstpsignal(void);
182 void md_tstphold(void);
183 void md_tstpresume(void (*tstp)(int));
184 void md_ignoreallsignals(void);
185 void md_onsignal_autosave(void);
186 void md_onsignal_exit(void);
187 void md_onsignal_default(void);
188 int md_issymlink(char *sp);
189 int md_loadav(double *avg);
190 long md_memused(void);
191 int md_ucount(void);
192 int md_unlockfile(FILE *fp);
193 int md_lockfile(FILE *fp);