File: unixconf.h

package info (click to toggle)
slashem 0.0.7E7F3-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 24,312 kB
  • ctags: 23,514
  • sloc: ansic: 263,201; cpp: 7,180; yacc: 2,154; sh: 739; lex: 440; awk: 97; makefile: 61; sed: 11
file content (440 lines) | stat: -rw-r--r-- 13,748 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
/*	SCCS Id: @(#)unixconf.h 3.4	1999/07/02	*/
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed.  See license for details. */

#ifdef UNIX
#ifndef UNIXCONF_H
#define UNIXCONF_H


/*
 * Some include files are in a different place under SYSV
 *	BSD		   SYSV
 * <sys/time.h>		<time.h>
 * <sgtty.h>		<termio.h>
 *
 * Some routines are called differently
 * index		strchr
 * rindex		strrchr
 *
 */

/* define exactly one of the following four choices */
#if defined(__FreeBSD_kernel__)
#define BSD 1	/* define for 4.n/Free/Open/Net BSD  */
			/* also for relatives like SunOS 4.x, DG/UX, and */
			/* older versions of Linux */
#endif
/* #define ULTRIX */	/* define for Ultrix v3.0 or higher (but not lower) */
			/* Use BSD for < v3.0 */
			/* "ULTRIX" not to be confused with "ultrix" */
#define SYSV		/* define for System V, Solaris 2.x, newer versions */
			/* of Linux */
/* #define HPUX */	/* Hewlett-Packard's Unix, version 6.5 or higher */
			/* use SYSV for < v6.5 */


/* define any of the following that are appropriate */
/* #define SVR4	*/	/* use in addition to SYSV for System V Release 4 */
			/* including Solaris 2+ */
#define NETWORK		/* if running on a networked system */
			/* e.g. Suns sharing a playground through NFS */
/* #define SUNOS4 */	/* SunOS 4.x */
#if defined(__linux__)
#define LINUX   	/* Another Unix clone */
#endif
/* #define CYGWIN32 */	/* Unix on Win32 -- use with case sensitive defines */
/* #define GENIX */	/* Yet Another Unix Clone */
/* #define HISX */	/* Bull Unix for XPS Machines */
/* #define BOS */	/* Bull Open Software - Unix for DPX/2 Machines */
/* #define UNIXPC */	/* use in addition to SYSV for AT&T 7300/3B1 */
/* #define AIX_31 */	/* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain
			 * job control (note that AIX is SYSV otherwise)
			 * Also define this for AIX 3.2 */

#define TERMINFO	/* uses terminfo rather than termcap */
			/* Should be defined for most SYSV, SVR4 (including
			 * Solaris 2+), HPUX, and Linux systems.  In
			 * particular, it should NOT be defined for the UNIXPC
			 * unless you remove the use of the shared library in
			 * the Makefile */
#define TEXTCOLOR	/* Use System V r3.2 terminfo color support */
			/* and/or ANSI color support on termcap systems */
			/* and/or X11 color */
#define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control */
			/* (e.g., VSUSP) */
#define POSIX_TYPES	/* use POSIX types for system calls and termios */
			/* Define for many recent OS releases, including
			 * those with specific defines (since types are
			 * changing toward the standard from earlier chaos).
			 * For example, platforms using the GNU libraries,
			 * Linux, Solaris 2.x
			 */

/* #define OPENWINBUG */	/* avoid a problem using OpenWindows 3.0 for
				   X11 on SunOS 4.1.x, x>= 2.  Do not define
				   for other X11 implementations. */
/* #define PYRAMID_BUG */	/* avoid a bug on the Pyramid */
/* #define BSD_43_BUG */	/* for real 4.3BSD cc's without schain botch fix */
/* #define MICROPORT_BUG */	/* problems with large arrays in structs */
/* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to
				   run with Microport Sys V/AT version 2.4.
				   By Jay Maynard */
/* #define AIXPS_2BUG */	/* avoid a problem with little_to_big() optimization */

/* #define RANDOM */		/* if neither random/srandom nor lrand48/srand48
				   is available from your system */

/* see sys/unix/snd86unx.shr for more information on these */
/* #define UNIX386MUSIC */	/* play real music through speaker on systems
				   with music driver installed */
/* #define VPIX_MUSIC */	/* play real music through speaker on systems
				   with built-in VPIX support */

/*
 * ALI
 *
 * File areas can be used to place different Slash'EM files in different
 * directories. This is necessary to comply with Linux's FSSTD 1.2 and its
 * replacement FHS 2.0. Currently, these are only implemented for UNIX, but
 * other ports could follow suit by including similar defines in their port
 * specific config files and implementing the relevent functions.
 *
 * File areas are supposed to be opaque; that is the core system does not
 * interpret them in any way, it simply passes them to the port specific
 * functions to handle. This means that while the obvious mapping is onto
 * directories, there is nothing in the core code that assumes this. Non-UNIX
 * ports in particular may find that a more general mapping is desirable.
 *
 * The following file areas are supported:
 *
 * FILE_AREA_SAVE	For save files (R/W)
 * FILE_AREA_BONES	For bones files (R/W)
 * FILE_AREA_LEVL	For level files (R/W)
 * FILE_AREA_VAR	For other files which may be modified by Slash'EM
 * FILE_AREA_SHARE	For read-only, architechure independent, files 
 * FILE_AREA_UNSHARE	For read-only, architechure dependent, files 
 * FILE_AREA_DOC	For human-readable documentation
 */

#define FILE_AREAS		/* Use file areas */

#ifdef FILE_AREAS

/*
 * File areas compatible with Linux's FSSTND 1.2.
 * Note: This has been superceeded by FHS 2.0, but is included because
 * many systems still seem to use it.
 */

/* #define FILE_AREA_VAR	"/var/lib/games/slashem/" */
/* #define FILE_AREA_SAVE	"/var/lib/games/slashem/save/" */
/* #define FILE_AREA_SHARE	"/usr/lib/games/slashem/" */
/* #define FILE_AREA_UNSHARE	"/usr/lib/games/slashem/" */
/* #define FILE_AREA_DOC	"/usr/doc/slashem/" */

/*
 * File areas compatible with FHS 2.0
 */

#define FILE_AREA_VAR		"/var/games/slashem/"
#define FILE_AREA_SAVE		"/var/games/slashem/save/"
#define FILE_AREA_SHARE		"/usr/share/games/slashem/"
#define FILE_AREA_UNSHARE	"/usr/lib/games/slashem/"
#define FILE_AREA_DOC		"/usr/share/doc/slashem/"

#define FILE_AREA_BONES		FILE_AREA_VAR
#define FILE_AREA_LEVL		FILE_AREA_VAR

#endif /* FILE_AREAS */

/*
 * The next two defines are intended mainly for the Andrew File System,
 * which does not allow hard links.  If NO_FILE_LINKS is defined, lock files
 * will be created in LOCKDIR using open() instead of in the playground using
 * link().
 *		Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88)
 */

/* #define NO_FILE_LINKS */	/* if no hard links */

#ifdef NO_FILE_LINKS
# ifdef FILE_AREAS
# define LOCKDIR FILE_AREA_VAR			/* where to put locks */
# else
# define LOCKDIR "/usr/games/lib/nethackdir"	/* where to put locks */
# endif
#endif

/*
 * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
 * If defined, it can be overridden by the environment variable PAGER.
 * Hack will use its internal pager if DEF_PAGER is not defined.
 * (This might be preferable for security reasons.)
 * #define DEF_PAGER	".../mydir/mypager"
 */

/*
 * If you want the static parts of your playground on a read-only file
 * system, define VAR_PLAYGROUND to be where the variable parts are kept.
 */
/* #define VAR_PLAYGROUND "/var/lib/games/nethack" */



/*
 * Define PORT_HELP to be the name of the port-specfic help file.
 * This file is found in HACKDIR.
 * Normally, you shouldn't need to change this.
 * There is currently no port-specific help for Unix systems.
 */
/* #define PORT_HELP "Unixhelp" */

#ifdef TTY_GRAPHICS
/*
 * To enable the `timed_delay' option for using a timer rather than extra
 * screen output when pausing for display effect.  Requires that `msleep'
 * function be available (with time argument specified in milliseconds).
 * Various output devices can produce wildly varying delays when the
 * "extra output" method is used, but not all systems provide access to
 * a fine-grained timer.
 */
/* #define TIMED_DELAY */	/* usleep() */

# ifdef TEXTCOLOR
#  define VIDEOSHADES
# endif
#endif

/*
 * If you define MAIL, then the player will be notified of new mail
 * when it arrives.  If you also define DEF_MAILREADER then this will
 * be the default mail reader, and can be overridden by the environment
 * variable MAILREADER; otherwise an internal pager will be used.
 * A stat system call is done on the mailbox every MAILCKFREQ moves.
 */

#define MAIL			/* Deliver mail during the game */

/* The Andrew Message System does mail a little differently from normal
 * UNIX.  Mail is deposited in the user's own directory in ~/Mailbox
 * (another directory).  MAILBOX is the element that will be added on to
 * the user's home directory path to generate the Mailbox path - just in
 * case other Andrew sites do it differently from CMU.
 *
 *		dan lovinger
 *		dl2n+@andrew.cmu.edu (dec 19 1989)
 */

/* #define AMS */		/* use Andrew message system for mail */

/* NO_MAILREADER is for kerberos authenticating filesystems where it is
 * essentially impossible to securely exec child processes, like mail
 * readers, when the game is running under a special token.
 *
 *	       dan
 */

/* #define NO_MAILREADER */	/* have mail daemon just tell player of mail */

#ifdef	MAIL
# if defined(BSD) || defined(ULTRIX)
#  ifdef AMS
#define AMS_MAILBOX	"/Mailbox"
#  else
#   if defined(__FreeBSD__) || defined(__OpenBSD__)
#define DEF_MAILREADER "/usr/bin/mail"
#   else
#define DEF_MAILREADER	"/usr/ucb/Mail"
#   endif
#  endif
#else
# if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX)
#  if defined(M_XENIX)
#define DEF_MAILREADER	"/usr/bin/mail"
#  else
#   ifdef __sgi
#define DEF_MAILREADER	"/usr/sbin/Mail"
#   else
#define DEF_MAILREADER	"/usr/bin/mailx"
#   endif
#  endif
# else
#define DEF_MAILREADER	"/bin/mail"
# endif
#endif

#define MAILCKFREQ	50
#endif	/* MAIL */



#ifdef COMPRESS
/* Some implementations of compress need a 'quiet' option.
 * If you've got one of these versions, put -q here.
 * You can also include any other strange options your compress needs.
 * If you have a normal compress, just leave it commented out.
 */
/* #define COMPRESS_OPTIONS "-q" */
#endif

#define FCMASK	0660	/* file creation mask */


/*
 * The remainder of the file should not need to be changed.
 */

#ifdef _AUX_SOURCE
# ifdef AUX /* gcc ? */
#  define _SYSV_SOURCE
#  define _BSD_SOURCE
#else
#  define AUX
# endif
#endif /* _AUX_SOURCE */

#if defined(LINUX) || defined(bsdi)
# ifndef POSIX_TYPES
#  define POSIX_TYPES
# endif
# ifndef POSIX_JOB_CONTROL
#  define POSIX_JOB_CONTROL
# endif
#endif

/*
 * BSD/ULTRIX systems are normally the only ones that can suspend processes.
 * Suspending NetHack processes cleanly should be easy to add to other systems
 * that have SIGTSTP in the Berkeley sense.  Currently the only such systems
 * known to work are HPUX and AIX 3.1; other systems will probably require
 * tweaks to unixtty.c and ioctl.c.
 *
 * POSIX defines a slightly different type of job control, which should be
 * equivalent for NetHack's purposes.  POSIX_JOB_CONTROL should work on
 * various recent SYSV versions (with possibly tweaks to unixtty.c again).
 */
#ifndef POSIX_JOB_CONTROL
# if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31)
#  define BSD_JOB_CONTROL
# else
#  if defined(SVR4)
#   define POSIX_JOB_CONTROL
#  endif
# endif
#endif
#if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX)
#define SUSPEND		/* let ^Z suspend the game */
#endif


#if defined(BSD) || defined(ULTRIX)
#include <sys/time.h>
#else
#include <time.h>
#endif

#define HLOCK	"perm"	/* an empty file used for locking purposes */
#define HLOCK_AREA	FILE_AREA_VAR

#ifndef REDO
#define Getchar nhgetch
#endif
#define tgetch getchar

#define SHELL		/* do not delete the '!' command */

/* -AJA- Escaping to a shell doesn't work when SDL port is running
 *       fullscreen (makes the computer seem frozen).  Undefining
 *       `SHELL' is a bit blunt though...
 */
#if defined(GL_GRAPHICS) || defined(SDL_GRAPHICS)
#undef SHELL
#endif

#include "system.h"

#if defined(POSIX_TYPES) || defined(__GNUC__)
#include <stdlib.h>
#include <unistd.h>
#endif

#if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) || defined(ULTRIX)
#include <sys/wait.h>
#endif

#if defined(BSD) || defined(ULTRIX)
# if !defined(DGUX) && !defined(SUNOS4)
#define memcpy(d, s, n)		bcopy(s, d, n)
#define memcmp(s1, s2, n)	bcmp(s2, s1, n)
# endif
# ifdef SUNOS4
#include <memory.h>
# endif
#else	/* therefore SYSV */
# ifndef index	/* some systems seem to do this for you */
#define index	strchr
# endif
# ifndef rindex
#define rindex	strrchr
# endif
#endif

/* Use the high quality random number routines. */
#if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM)
#define Rand()	random()
#else
#define Rand()	lrand48()
#endif

#ifdef TIMED_DELAY
# if defined(SUNOS4) || defined(LINUX) || defined(SVR4) /* [max] added SVR4 */
# define msleep(k) usleep((k)*1000)
# endif
# ifdef ULTRIX
# define msleep(k) napms(k)
# endif
#endif

#ifdef hc	/* older versions of the MetaWare High-C compiler define this */
# ifdef __HC__
#  undef __HC__
# endif
# define __HC__ hc
# undef hc
#endif

#if defined(GNOME_GRAPHICS)
#if defined(LINUX)
# include <linux/unistd.h>
# if defined(__NR_getresuid) && defined(__NR_getresgid)	/* ie., >= v2.1.44 */
#  define GETRES_SUPPORT
# endif
#else
# if defined(BSD) || defined(SVR4)
/*
 * [ALI] We assume that SVR4 means we can safely include syscall.h
 * (although it's really a BSDism). This is certainly true for Solaris 2.5,
 * Solaris 7, Solaris 8 and Compaq Tru64 5.1
 * Later BSD systems will have the getresid system calls.
 */
# include <sys/syscall.h>
# if (defined (SYS_getuid) || defined(SYS_getresuid)) && \
  (defined(SYS_getgid) || defined(SYS_getresgid))
#  define GETRES_SUPPORT
# endif
# endif	/* BSD || SVR4 */
#endif	/* LINUX */
#endif	/* GNOME_GRAPHICS */

#if defined(MENU_COLOR) && defined(USE_REGEX_MATCH)
# include <regex.h>
# ifndef RE_NO_GNU_OPS
#  define POSIX_REGEX
# else
#  define GNU_REGEX
# endif
#endif

#endif /* UNIXCONF_H */
#endif /* UNIX */