Source:SLASH'EM 0.0.7E7F2/unixconf.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to unixconf.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[Source:SLASH'EM 0.0.7E7F2/unixconf.h#line123]], for example.

Source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    /*	SCCS Id: @(#)unixconf.h 3.4	1999/07/02	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifdef UNIX
6.    #ifndef UNIXCONF_H
7.    #define UNIXCONF_H
8.    
9.    
10.   /*
11.    * Some include files are in a different place under SYSV
12.    *	BSD		   SYSV
13.    * <sys/time.h>		<time.h>
14.    * <sgtty.h>		<termio.h>
15.    *
16.    * Some routines are called differently
17.    * index		strchr
18.    * rindex		strrchr
19.    *
20.    */
21.   
22.   /* define exactly one of the following four choices */
23.   /* #define BSD 1 */	/* define for 4.n/Free/Open/Net BSD  */
24.   			/* also for relatives like SunOS 4.x, DG/UX, and */
25.   			/* older versions of Linux */
26.   /* #define ULTRIX */	/* define for Ultrix v3.0 or higher (but not lower) */
27.   			/* Use BSD for < v3.0 */
28.   			/* "ULTRIX" not to be confused with "ultrix" */
29.   #define SYSV		/* define for System V, Solaris 2.x, newer versions */
30.   			/* of Linux */
31.   /* #define HPUX */	/* Hewlett-Packard's Unix, version 6.5 or higher */
32.   			/* use SYSV for < v6.5 */
33.   
34.   
35.   /* define any of the following that are appropriate */
36.   #define SVR4		/* use in addition to SYSV for System V Release 4 */
37.   			/* including Solaris 2+ */
38.   #define NETWORK		/* if running on a networked system */
39.   			/* e.g. Suns sharing a playground through NFS */
40.   /* #define SUNOS4 */	/* SunOS 4.x */
41.   /* #define LINUX */	/* Another Unix clone */
42.   /* #define CYGWIN32 */	/* Unix on Win32 -- use with case sensitive defines */
43.   /* #define GENIX */	/* Yet Another Unix Clone */
44.   /* #define HISX */	/* Bull Unix for XPS Machines */
45.   /* #define BOS */	/* Bull Open Software - Unix for DPX/2 Machines */
46.   /* #define UNIXPC */	/* use in addition to SYSV for AT&T 7300/3B1 */
47.   /* #define AIX_31 */	/* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain
48.   			 * job control (note that AIX is SYSV otherwise)
49.   			 * Also define this for AIX 3.2 */
50.   
51.   #define TERMINFO	/* uses terminfo rather than termcap */
52.   			/* Should be defined for most SYSV, SVR4 (including
53.   			 * Solaris 2+), HPUX, and Linux systems.  In
54.   			 * particular, it should NOT be defined for the UNIXPC
55.   			 * unless you remove the use of the shared library in
56.   			 * the Makefile */
57.   #define TEXTCOLOR	/* Use System V r3.2 terminfo color support */
58.   			/* and/or ANSI color support on termcap systems */
59.   			/* and/or X11 color */
60.   #define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control */
61.   			/* (e.g., VSUSP) */
62.   #define POSIX_TYPES	/* use POSIX types for system calls and termios */
63.   			/* Define for many recent OS releases, including
64.   			 * those with specific defines (since types are
65.   			 * changing toward the standard from earlier chaos).
66.   			 * For example, platforms using the GNU libraries,
67.   			 * Linux, Solaris 2.x
68.   			 */
69.   
70.   /* #define OPENWINBUG */	/* avoid a problem using OpenWindows 3.0 for
71.   				   X11 on SunOS 4.1.x, x>= 2.  Do not define
72.   				   for other X11 implementations. */
73.   /* #define PYRAMID_BUG */	/* avoid a bug on the Pyramid */
74.   /* #define BSD_43_BUG */	/* for real 4.3BSD cc's without schain botch fix */
75.   /* #define MICROPORT_BUG */	/* problems with large arrays in structs */
76.   /* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to
77.   				   run with Microport Sys V/AT version 2.4.
78.   				   By Jay Maynard */
79.   /* #define AIXPS_2BUG */	/* avoid a problem with little_to_big() optimization */
80.   
81.   /* #define RANDOM */		/* if neither random/srandom nor lrand48/srand48
82.   				   is available from your system */
83.   
84.   /* see sys/unix/snd86unx.shr for more information on these */
85.   /* #define UNIX386MUSIC */	/* play real music through speaker on systems
86.   				   with music driver installed */
87.   /* #define VPIX_MUSIC */	/* play real music through speaker on systems
88.   				   with built-in VPIX support */
89.   
90.   /*
91.    * ALI
92.    *
93.    * File areas can be used to place different Slash'EM files in different
94.    * directories. This is necessary to comply with Linux's FSSTD 1.2 and its
95.    * replacement FHS 2.0. Currently, these are only implemented for UNIX, but
96.    * other ports could follow suit by including similar defines in their port
97.    * specific config files and implementing the relevent functions.
98.    *
99.    * File areas are supposed to be opaque; that is the core system does not
100.   * interpret them in any way, it simply passes them to the port specific
101.   * functions to handle. This means that while the obvious mapping is onto
102.   * directories, there is nothing in the core code that assumes this. Non-UNIX
103.   * ports in particular may find that a more general mapping is desirable.
104.   *
105.   * The following file areas are supported:
106.   *
107.   * FILE_AREA_SAVE	For save files (R/W)
108.   * FILE_AREA_BONES	For bones files (R/W)
109.   * FILE_AREA_LEVL	For level files (R/W)
110.   * FILE_AREA_VAR	For other files which may be modified by Slash'EM
111.   * FILE_AREA_SHARE	For read-only, architechure independent, files 
112.   * FILE_AREA_UNSHARE	For read-only, architechure dependent, files 
113.   * FILE_AREA_DOC	For human-readable documentation
114.   */
115.  
116.  /* #define FILE_AREAS */		/* Use file areas */
117.  
118.  #ifdef FILE_AREAS
119.  
120.  /*
121.   * File areas compatible with Linux's FSSTND 1.2.
122.   * Note: This has been superceeded by FHS 2.0, but is included because
123.   * many systems still seem to use it.
124.   */
125.  
126.  /* #define FILE_AREA_VAR	"/var/lib/games/slashem/" */
127.  /* #define FILE_AREA_SAVE	"/var/lib/games/slashem/save/" */
128.  /* #define FILE_AREA_SHARE	"/usr/lib/games/slashem/" */
129.  /* #define FILE_AREA_UNSHARE	"/usr/lib/games/slashem/" */
130.  /* #define FILE_AREA_DOC	"/usr/doc/slashem/" */
131.  
132.  /*
133.   * File areas compatible with FHS 2.0
134.   */
135.  
136.  #define FILE_AREA_VAR		"/var/games/slashem/"
137.  #define FILE_AREA_SAVE		"/var/games/slashem/save/"
138.  #define FILE_AREA_SHARE		"/usr/share/games/slashem/"
139.  #define FILE_AREA_UNSHARE	"/usr/lib/games/slashem/"
140.  #define FILE_AREA_DOC		"/usr/share/doc/slashem/"
141.  
142.  #define FILE_AREA_BONES		FILE_AREA_VAR
143.  #define FILE_AREA_LEVL		FILE_AREA_VAR
144.  
145.  #endif /* FILE_AREAS */
146.  
147.  /*
148.   * The next two defines are intended mainly for the Andrew File System,
149.   * which does not allow hard links.  If NO_FILE_LINKS is defined, lock files
150.   * will be created in LOCKDIR using open() instead of in the playground using
151.   * link().
152.   *		Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88)
153.   */
154.  
155.  /* #define NO_FILE_LINKS */	/* if no hard links */
156.  
157.  #ifdef NO_FILE_LINKS
158.  # ifdef FILE_AREAS
159.  # define LOCKDIR FILE_AREA_VAR			/* where to put locks */
160.  # else
161.  # define LOCKDIR "/usr/games/lib/nethackdir"	/* where to put locks */
162.  # endif
163.  #endif
164.  
165.  /*
166.   * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
167.   * If defined, it can be overridden by the environment variable PAGER.
168.   * Hack will use its internal pager if DEF_PAGER is not defined.
169.   * (This might be preferable for security reasons.)
170.   * #define DEF_PAGER	".../mydir/mypager"
171.   */
172.  
173.  /*
174.   * If you want the static parts of your playground on a read-only file
175.   * system, define VAR_PLAYGROUND to be where the variable parts are kept.
176.   */
177.  /* #define VAR_PLAYGROUND "/var/lib/games/nethack" */
178.  
179.  
180.  
181.  /*
182.   * Define PORT_HELP to be the name of the port-specfic help file.
183.   * This file is found in HACKDIR.
184.   * Normally, you shouldn't need to change this.
185.   * There is currently no port-specific help for Unix systems.
186.   */
187.  /* #define PORT_HELP "Unixhelp" */
188.  
189.  #ifdef TTY_GRAPHICS
190.  /*
191.   * To enable the `timed_delay' option for using a timer rather than extra
192.   * screen output when pausing for display effect.  Requires that `msleep'
193.   * function be available (with time argument specified in milliseconds).
194.   * Various output devices can produce wildly varying delays when the
195.   * "extra output" method is used, but not all systems provide access to
196.   * a fine-grained timer.
197.   */
198.  /* #define TIMED_DELAY */	/* usleep() */
199.  
200.  # ifdef TEXTCOLOR
201.  #  define VIDEOSHADES
202.  # endif
203.  #endif
204.  
205.  /*
206.   * If you define MAIL, then the player will be notified of new mail
207.   * when it arrives.  If you also define DEF_MAILREADER then this will
208.   * be the default mail reader, and can be overridden by the environment
209.   * variable MAILREADER; otherwise an internal pager will be used.
210.   * A stat system call is done on the mailbox every MAILCKFREQ moves.
211.   */
212.  
213.  #define MAIL			/* Deliver mail during the game */
214.  
215.  /* The Andrew Message System does mail a little differently from normal
216.   * UNIX.  Mail is deposited in the user's own directory in ~/Mailbox
217.   * (another directory).  MAILBOX is the element that will be added on to
218.   * the user's home directory path to generate the Mailbox path - just in
219.   * case other Andrew sites do it differently from CMU.
220.   *
221.   *		dan lovinger
222.   *		dl2n+@andrew.cmu.edu (dec 19 1989)
223.   */
224.  
225.  /* #define AMS */		/* use Andrew message system for mail */
226.  
227.  /* NO_MAILREADER is for kerberos authenticating filesystems where it is
228.   * essentially impossible to securely exec child processes, like mail
229.   * readers, when the game is running under a special token.
230.   *
231.   *	       dan
232.   */
233.  
234.  /* #define NO_MAILREADER */	/* have mail daemon just tell player of mail */
235.  
236.  #ifdef	MAIL
237.  # if defined(BSD) || defined(ULTRIX)
238.  #  ifdef AMS
239.  #define AMS_MAILBOX	"/Mailbox"
240.  #  else
241.  #   if defined(__FreeBSD__) || defined(__OpenBSD__)
242.  #define DEF_MAILREADER "/usr/bin/mail"
243.  #   else
244.  #define DEF_MAILREADER	"/usr/ucb/Mail"
245.  #   endif
246.  #  endif
247.  #else
248.  # if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX)
249.  #  if defined(M_XENIX)
250.  #define DEF_MAILREADER	"/usr/bin/mail"
251.  #  else
252.  #   ifdef __sgi
253.  #define DEF_MAILREADER	"/usr/sbin/Mail"
254.  #   else
255.  #define DEF_MAILREADER	"/usr/bin/mailx"
256.  #   endif
257.  #  endif
258.  # else
259.  #define DEF_MAILREADER	"/bin/mail"
260.  # endif
261.  #endif
262.  
263.  #define MAILCKFREQ	50
264.  #endif	/* MAIL */
265.  
266.  
267.  
268.  #ifdef COMPRESS
269.  /* Some implementations of compress need a 'quiet' option.
270.   * If you've got one of these versions, put -q here.
271.   * You can also include any other strange options your compress needs.
272.   * If you have a normal compress, just leave it commented out.
273.   */
274.  /* #define COMPRESS_OPTIONS "-q" */
275.  #endif
276.  
277.  #define FCMASK	0660	/* file creation mask */
278.  
279.  
280.  /*
281.   * The remainder of the file should not need to be changed.
282.   */
283.  
284.  #ifdef _AUX_SOURCE
285.  # ifdef AUX /* gcc ? */
286.  #  define _SYSV_SOURCE
287.  #  define _BSD_SOURCE
288.  #else
289.  #  define AUX
290.  # endif
291.  #endif /* _AUX_SOURCE */
292.  
293.  #if defined(LINUX) || defined(bsdi)
294.  # ifndef POSIX_TYPES
295.  #  define POSIX_TYPES
296.  # endif
297.  # ifndef POSIX_JOB_CONTROL
298.  #  define POSIX_JOB_CONTROL
299.  # endif
300.  #endif
301.  
302.  /*
303.   * BSD/ULTRIX systems are normally the only ones that can suspend processes.
304.   * Suspending NetHack processes cleanly should be easy to add to other systems
305.   * that have SIGTSTP in the Berkeley sense.  Currently the only such systems
306.   * known to work are HPUX and AIX 3.1; other systems will probably require
307.   * tweaks to unixtty.c and ioctl.c.
308.   *
309.   * POSIX defines a slightly different type of job control, which should be
310.   * equivalent for NetHack's purposes.  POSIX_JOB_CONTROL should work on
311.   * various recent SYSV versions (with possibly tweaks to unixtty.c again).
312.   */
313.  #ifndef POSIX_JOB_CONTROL
314.  # if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31)
315.  #  define BSD_JOB_CONTROL
316.  # else
317.  #  if defined(SVR4)
318.  #   define POSIX_JOB_CONTROL
319.  #  endif
320.  # endif
321.  #endif
322.  #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX)
323.  #define SUSPEND		/* let ^Z suspend the game */
324.  #endif
325.  
326.  
327.  #if defined(BSD) || defined(ULTRIX)
328.  #include <sys/time.h>
329.  #else
330.  #include <time.h>
331.  #endif
332.  
333.  #define HLOCK	"perm"	/* an empty file used for locking purposes */
334.  #define HLOCK_AREA	FILE_AREA_VAR
335.  
336.  #ifndef REDO
337.  #define Getchar nhgetch
338.  #endif
339.  #define tgetch getchar
340.  
341.  #define SHELL		/* do not delete the '!' command */
342.  
343.  /* -AJA- Escaping to a shell doesn't work when SDL port is running
344.   *       fullscreen (makes the computer seem frozen).  Undefining
345.   *       `SHELL' is a bit blunt though...
346.   */
347.  #if defined(GL_GRAPHICS) || defined(SDL_GRAPHICS)
348.  #undef SHELL
349.  #endif
350.  
351.  #include "system.h"
352.  
353.  #if defined(POSIX_TYPES) || defined(__GNUC__)
354.  #include <stdlib.h>
355.  #include <unistd.h>
356.  #endif
357.  
358.  #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) || defined(ULTRIX)
359.  #include <sys/wait.h>
360.  #endif
361.  
362.  #if defined(BSD) || defined(ULTRIX)
363.  # if !defined(DGUX) && !defined(SUNOS4)
364.  #define memcpy(d, s, n)		bcopy(s, d, n)
365.  #define memcmp(s1, s2, n)	bcmp(s2, s1, n)
366.  # endif
367.  # ifdef SUNOS4
368.  #include <memory.h>
369.  # endif
370.  #else	/* therefore SYSV */
371.  # ifndef index	/* some systems seem to do this for you */
372.  #define index	strchr
373.  # endif
374.  # ifndef rindex
375.  #define rindex	strrchr
376.  # endif
377.  #endif
378.  
379.  /* Use the high quality random number routines. */
380.  #if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM)
381.  #define Rand()	random()
382.  #else
383.  #define Rand()	lrand48()
384.  #endif
385.  
386.  #ifdef TIMED_DELAY
387.  # if defined(SUNOS4) || defined(LINUX) || defined(SVR4) /* [max] added SVR4 */
388.  # define msleep(k) usleep((k)*1000)
389.  # endif
390.  # ifdef ULTRIX
391.  # define msleep(k) napms(k)
392.  # endif
393.  #endif
394.  
395.  #ifdef hc	/* older versions of the MetaWare High-C compiler define this */
396.  # ifdef __HC__
397.  #  undef __HC__
398.  # endif
399.  # define __HC__ hc
400.  # undef hc
401.  #endif
402.  
403.  #if defined(GNOME_GRAPHICS)
404.  #if defined(LINUX)
405.  # include <linux/unistd.h>
406.  # if defined(__NR_getresuid) && defined(__NR_getresgid)	/* ie., >= v2.1.44 */
407.  #  define GETRES_SUPPORT
408.  # endif
409.  #else
410.  # if defined(BSD) || defined(SVR4)
411.  /*
412.   * [ALI] We assume that SVR4 means we can safely include syscall.h
413.   * (although it's really a BSDism). This is certainly true for Solaris 2.5,
414.   * Solaris 7, Solaris 8 and Compaq Tru64 5.1
415.   * Later BSD systems will have the getresid system calls.
416.   */
417.  # include <sys/syscall.h>
418.  # if (defined (SYS_getuid) || defined(SYS_getresuid)) && \
419.    (defined(SYS_getgid) || defined(SYS_getresgid))
420.  #  define GETRES_SUPPORT
421.  # endif
422.  # endif	/* BSD || SVR4 */
423.  #endif	/* LINUX */
424.  #endif	/* GNOME_GRAPHICS */
425.  
426.  #if defined(USE_REGEX_MATCH)
427.  # if defined(__FreeBSD__) || defined(__OpenBSD__)
428.  #  define POSIX_REGEX
429.  # else
430.  #  define GNU_REGEX
431.  # endif
432.  #endif
433.  
434.  #endif /* UNIXCONF_H */
435.  #endif /* UNIX */