NHDT->ANH, nethack->anethack, nhdat->anhdat
[aNetHack.git] / include / unixconf.h
blob378729d2f8a8010f34dc900baedd01e4f3c20700
1 /* aNetHack 0.0.1 unixconf.h $ANH-Date: 1451342112 2015/12/28 22:35:12 $ $ANH-Branch: master $:$ANH-Revision: 1.25 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* aNetHack may be freely redistributed. See license for details. */
5 #ifdef UNIX
6 #ifndef UNIXCONF_H
7 #define UNIXCONF_H
9 /*
10 * Some include files are in a different place under SYSV
11 * BSD SYSV
12 * <sys/time.h> <time.h>
13 * <sgtty.h> <termio.h>
15 * Some routines are called differently
16 * index strchr
17 * rindex strrchr
21 /* define exactly one of the following four choices */
22 /* #define BSD 1 */ /* define for 4.n/Free/Open/Net BSD */
23 /* also for relatives like SunOS 4.x, DG/UX, and */
24 /* older versions of Linux */
25 /* #define ULTRIX */ /* define for Ultrix v3.0 or higher (but not lower) */
26 /* Use BSD for < v3.0 */
27 /* "ULTRIX" not to be confused with "ultrix" */
28 #define SYSV /* define for System V, Solaris 2.x, newer versions */
29 /* of Linux */
30 /* #define HPUX */ /* Hewlett-Packard's Unix, version 6.5 or higher */
31 /* use SYSV for < v6.5 */
33 /* define any of the following that are appropriate */
34 #define SVR4 /* use in addition to SYSV for System V Release 4 */
35 /* including Solaris 2+ */
36 #define NETWORK /* if running on a networked system */
37 /* e.g. Suns sharing a playground through NFS */
38 /* #define SUNOS4 */ /* SunOS 4.x */
39 /* #define LINUX */ /* Another Unix clone */
40 /* #define CYGWIN32 */ /* Unix on Win32 -- use with case sensitive defines */
41 /* #define GENIX */ /* Yet Another Unix Clone */
42 /* #define HISX */ /* Bull Unix for XPS Machines */
43 /* #define BOS */ /* Bull Open Software - Unix for DPX/2 Machines */
44 /* #define UNIXPC */ /* use in addition to SYSV for AT&T 7300/3B1 */
45 /* #define AIX_31 */ /* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain
46 * job control (note that AIX is SYSV otherwise)
47 * Also define this for AIX 3.2 */
49 #define TERMINFO /* uses terminfo rather than termcap */
50 /* Should be defined for most SYSV, SVR4 (including
51 * Solaris 2+), HPUX, and Linux systems. In
52 * particular, it should NOT be defined for the UNIXPC
53 * unless you remove the use of the shared library in
54 * the Makefile */
55 #define TEXTCOLOR /* Use System V r3.2 terminfo color support
56 * and/or ANSI color support on termcap systems
57 * and/or X11 color */
58 #define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control
59 * (e.g., VSUSP) */
60 #define POSIX_TYPES /* use POSIX types for system calls and termios */
61 /* Define for many recent OS releases, including
62 * those with specific defines (since types are
63 * changing toward the standard from earlier chaos).
64 * For example, platforms using the GNU libraries,
65 * Linux, Solaris 2.x
68 /* #define OPENWINBUG */ /* avoid a problem using OpenWindows 3.0 for
69 X11 on SunOS 4.1.x, x>= 2. Do not define
70 for other X11 implementations. */
71 /* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */
72 /* #define BSD_43_BUG */ /* for real 4.3BSD cc's without schain botch fix */
73 /* #define MICROPORT_BUG */ /* problems with large arrays in structs */
74 /* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to
75 run with Microport Sys V/AT version 2.4.
76 By Jay Maynard */
77 /* #define AIXPS_2BUG */ /* avoid a problem with little_to_big() optimization
80 /* #define RANDOM */ /* if neither random/srandom nor lrand48/srand48
81 is available from your system */
83 /* see sys/unix/snd86unx.shr for more information on these */
84 /* #define UNIX386MUSIC */ /* play real music through speaker on systems
85 with music driver installed */
86 /* #define VPIX_MUSIC */ /* play real music through speaker on systems
87 with built-in VPIX support */
90 * The next two defines are intended mainly for the Andrew File System,
91 * which does not allow hard links. If NO_FILE_LINKS is defined, lock files
92 * will be created in LOCKDIR using open() instead of in the playground using
93 * link().
94 * Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88)
97 /* #define NO_FILE_LINKS */ /* if no hard links */
98 /* #define LOCKDIR "/usr/games/lib/anethackdir" */ /* where to put locks */
101 * If you want the static parts of your playground on a read-only file
102 * system, define VAR_PLAYGROUND to be where the variable parts are kept.
104 /* #define VAR_PLAYGROUND "/var/lib/games/anethack" */
107 * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
108 * If defined, it can be overridden by the environment variable PAGER.
109 * Hack will use its internal pager if DEF_PAGER is not defined.
110 * (This might be preferable for security reasons.)
112 /* #define DEF_PAGER ".../mydir/mypager" */
115 * Define PORT_HELP to be the name of the port-specfic help file.
116 * This file is found in HACKDIR.
117 * Normally, you shouldn't need to change this.
118 * There is currently no port-specific help for Unix systems.
120 /* #define PORT_HELP "Unixhelp" */
122 #ifdef TTY_GRAPHICS
124 * To enable the `timed_delay' option for using a timer rather than extra
125 * screen output when pausing for display effect. Requires that `msleep'
126 * function be available (with time argument specified in milliseconds).
127 * Various output devices can produce wildly varying delays when the
128 * "extra output" method is used, but not all systems provide access to
129 * a fine-grained timer.
131 /* #define TIMED_DELAY */ /* usleep() */
132 #endif
133 #if defined(MACOSX) && !defined(TIMED_DELAY)
134 #define TIMED_DELAY
135 #endif
138 * If you define MAIL, then the player will be notified of new mail
139 * when it arrives. If you also define DEF_MAILREADER then this will
140 * be the default mail reader, and can be overridden by the environment
141 * variable MAILREADER; otherwise an internal pager will be used.
142 * A stat system call is done on the mailbox every MAILCKFREQ moves.
144 #if !defined(NOMAIL)
145 #define MAIL /* Deliver mail during the game */
146 #endif
148 /* The Andrew Message System does mail a little differently from normal
149 * UNIX. Mail is deposited in the user's own directory in ~/Mailbox
150 * (another directory). MAILBOX is the element that will be added on to
151 * the user's home directory path to generate the Mailbox path - just in
152 * case other Andrew sites do it differently from CMU.
153 * dan lovinger
154 * dl2n+@andrew.cmu.edu (dec 19 1989)
157 /* #define AMS */ /* use Andrew message system for mail */
159 /* NO_MAILREADER is for kerberos authenticating filesystems where it is
160 * essentially impossible to securely exec child processes, like mail
161 * readers, when the game is running under a special token.
162 * dan
165 /* #define NO_MAILREADER */ /* have mail daemon just tell player of mail */
167 #ifdef MAIL
168 #if defined(BSD) || defined(ULTRIX)
169 #ifdef AMS
170 #define AMS_MAILBOX "/Mailbox"
171 #else
172 #if defined(__FreeBSD__) || defined(__OpenBSD__)
173 #define DEF_MAILREADER "/usr/bin/mail"
174 #else
175 #define DEF_MAILREADER "/usr/ucb/Mail"
176 #endif
177 #endif
178 #else
179 #if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX)
180 #if defined(M_XENIX)
181 #define DEF_MAILREADER "/usr/bin/mail"
182 #else
183 #ifdef __sgi
184 #define DEF_MAILREADER "/usr/sbin/Mail"
185 #else
186 #define DEF_MAILREADER "/usr/bin/mailx"
187 #endif
188 #endif
189 #else
190 #define DEF_MAILREADER "/bin/mail"
191 #endif
192 #endif
194 /* If SIMPLE_MAIL is defined, the mail spool file format is
195 "sender:message", one mail per line, and mails are
196 read within game, from demon-delivered mail scrolls.
197 The mail spool file will be deleted once the player
198 has read the message. */
199 /* #define SIMPLE_MAIL */
201 #ifndef MAILCKFREQ
202 /* How often mail spool file is checked for new messages, in turns */
203 #define MAILCKFREQ 50
204 #endif
206 #endif /* MAIL */
208 /* If SERVER_ADMIN_MSG is defined and the file exists, players get
209 a message from the user defined in the file. The file format
210 is "sender:message" all in one line. */
211 /* #define SERVER_ADMIN_MSG "adminmsg" */
212 #ifndef SERVER_ADMIN_MSG_CKFREQ
213 /* How often admin message file is checked for new messages, in turns */
214 #define SERVER_ADMIN_MSG_CKFREQ 25
215 #endif
219 * Some terminals or terminal emulators send two character sequence "ESC c"
220 * when Alt+c is pressed. The altmeta run-time option allows the user to
221 * request that "ESC c" be treated as M-c.
223 #define ALTMETA /* support altmeta run-time option */
225 #ifdef COMPRESS
226 /* Some implementations of compress need a 'quiet' option.
227 * If you've got one of these versions, put -q here.
228 * You can also include any other strange options your compress needs.
229 * If you have a normal compress, just leave it commented out.
231 /* #define COMPRESS_OPTIONS "-q" */
232 #endif
234 #define FCMASK 0660 /* file creation mask */
236 /* fcntl(2) is a POSIX-portable call for manipulating file descriptors.
237 * Comment out the USE_FCNTL if for some reason you have a strange
238 * OS/filesystem combination for which fcntl(2) does not work. */
239 #ifdef POSIX_TYPES
240 #define USE_FCNTL
241 #endif
244 * The remainder of the file should not need to be changed.
247 #ifdef _AUX_SOURCE
248 #ifdef AUX /* gcc ? */
249 #define _SYSV_SOURCE
250 #define _BSD_SOURCE
251 #else
252 #define AUX
253 #endif
254 #endif /* _AUX_SOURCE */
256 #if defined(LINUX) || defined(bsdi)
257 #ifndef POSIX_TYPES
258 #define POSIX_TYPES
259 #endif
260 #ifndef POSIX_JOB_CONTROL
261 #define POSIX_JOB_CONTROL
262 #endif
263 #endif
266 * BSD/ULTRIX systems are normally the only ones that can suspend processes.
267 * Suspending aNetHack processes cleanly should be easy to add to other systems
268 * that have SIGTSTP in the Berkeley sense. Currently the only such systems
269 * known to work are HPUX and AIX 3.1; other systems will probably require
270 * tweaks to unixtty.c and ioctl.c.
272 * POSIX defines a slightly different type of job control, which should be
273 * equivalent for aNetHack's purposes. POSIX_JOB_CONTROL should work on
274 * various recent SYSV versions (with possibly tweaks to unixtty.c again).
276 #ifndef POSIX_JOB_CONTROL
277 #if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31)
278 #define BSD_JOB_CONTROL
279 #else
280 #if defined(SVR4)
281 #define POSIX_JOB_CONTROL
282 #endif
283 #endif
284 #endif
285 #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX)
286 #define SUSPEND /* let ^Z suspend the game */
287 #endif
290 * Define SAFERHANGUP to delay hangup processing until the main command
291 * loop. 'safer' because it avoids certain cheats and also avoids losing
292 * objects being thrown when the hangup occurs. All unix windowports
293 * support SAFERHANGUP (couldn't define it here otherwise).
295 #define SAFERHANGUP
297 #if defined(BSD) || defined(ULTRIX)
298 #include <sys/time.h>
299 #else
300 #include <time.h>
301 #endif
303 #define HLOCK "perm" /* an empty file used for locking purposes */
305 #define tgetch getchar
307 #ifndef NOSHELL
308 #define SHELL /* do not delete the '!' command */
309 #endif
311 #include "system.h"
313 #if defined(POSIX_TYPES) || defined(__GNUC__)
314 #include <stdlib.h>
315 #include <unistd.h>
316 #endif
318 #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) \
319 || defined(ULTRIX)
320 #include <sys/wait.h>
321 #endif
323 #if defined(BSD) || defined(ULTRIX)
324 #if !defined(DGUX) && !defined(SUNOS4)
325 #define memcpy(d, s, n) bcopy(s, d, n)
326 #define memcmp(s1, s2, n) bcmp(s2, s1, n)
327 #endif
328 #ifdef SUNOS4
329 #include <memory.h>
330 #endif
331 #else /* therefore SYSV */
332 #ifndef index /* some systems seem to do this for you */
333 #define index strchr
334 #endif
335 #ifndef rindex
336 #define rindex strrchr
337 #endif
338 #endif
340 /* Use the high quality random number routines. */
341 #if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \
342 || defined(RANDOM) || defined(__APPLE__)
343 #define Rand() random()
344 #else
345 #define Rand() lrand48()
346 #endif
348 #ifdef TIMED_DELAY
349 #if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX))
350 #define msleep(k) usleep((k) *1000)
351 #endif
352 #ifdef ULTRIX
353 #define msleep(k) napms(k)
354 #endif
355 #endif
357 #ifdef hc /* older versions of the MetaWare High-C compiler define this */
358 #ifdef __HC__
359 #undef __HC__
360 #endif
361 #define __HC__ hc
362 #undef hc
363 #endif
365 #if defined(GNOME_GRAPHICS)
366 #if defined(LINUX)
367 #include <linux/unistd.h>
368 #if defined(__NR_getresuid) && defined(__NR_getresgid) /* ie., >= v2.1.44 */
369 #define GETRES_SUPPORT
370 #endif
371 #else
372 #if defined(BSD) || defined(SVR4)
374 * [ALI] We assume that SVR4 means we can safely include syscall.h
375 * (although it's really a BSDism). This is certainly true for Solaris 2.5,
376 * Solaris 7, Solaris 8 and Compaq Tru64 5.1
377 * Later BSD systems will have the getresid system calls.
379 #include <sys/syscall.h>
380 #if (defined(SYS_getuid) || defined(SYS_getresuid)) \
381 && (defined(SYS_getgid) || defined(SYS_getresgid))
382 #define GETRES_SUPPORT
383 #endif
384 #endif /* BSD || SVR4 */
385 #endif /* LINUX */
386 #endif /* GNOME_GRAPHICS */
388 #endif /* UNIXCONF_H */
389 #endif /* UNIX */