Source:NetHack 3.4.3/include/unixconf.h

From NetHackWiki
Jump to: navigation, search

Below is the full text to include/unixconf.h from NetHack 3.4.3. To link to a particular line, write [[unixconf.h#line123]], for example.

  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. */

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. #ifdef UNIX
  2. #ifndef UNIXCONF_H
  3. #define UNIXCONF_H
  4.  
  5. /*
  6. * Some include files are in a different place under SYSV
  7. *	BSD		   SYSV
  8. * <sys/time.h>		<time.h>
  9. * <sgtty.h>		<termio.h>
  10. *
  11. * Some routines are called differently
  12. * index		strchr
  13. * rindex		strrchr
  14. *
  15. */
  16.  
  17. /* define exactly one of the following four choices */
  18. /* #define BSD 1 */	/* define for 4.n/Free/Open/Net BSD  */
  19. 			/* also for relatives like SunOS 4.x, DG/UX, and */
  20. 			/* older versions of Linux */
  21. /* #define ULTRIX */	/* define for Ultrix v3.0 or higher (but not lower) */
  22. 			/* Use BSD for < v3.0 */
  23. 			/* "ULTRIX" not to be confused with "ultrix" */
  24. #define SYSV		/* define for System V, Solaris 2.x, newer versions */
  25. 			/* of Linux */
  26. /* #define HPUX */	/* Hewlett-Packard's Unix, version 6.5 or higher */
  27. 			/* use SYSV for < v6.5 */
  28.  
  29.  
  30. /* define any of the following that are appropriate */
  31. #define SVR4		/* use in addition to SYSV for System V Release 4 */
  32. 			/* including Solaris 2+ */
  33. #define NETWORK		/* if running on a networked system */
  34. 			/* e.g. Suns sharing a playground through NFS */
  35. /* #define SUNOS4 */	/* SunOS 4.x */
  36. /* #define LINUX */	/* Another Unix clone */
  37. /* #define CYGWIN32 */	/* Unix on Win32 -- use with case sensitive defines */
  38. /* #define GENIX */	/* Yet Another Unix Clone */
  39. /* #define HISX */	/* Bull Unix for XPS Machines */
  40. /* #define BOS */	/* Bull Open Software - Unix for DPX/2 Machines */
  41. /* #define UNIXPC */	/* use in addition to SYSV for AT&T 7300/3B1 */
  42. /* #define AIX_31 */	/* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain
  43. 			 * job control (note that AIX is SYSV otherwise)
  44. 			 * Also define this for AIX 3.2 */
  45.  
  46. #define TERMINFO	/* uses terminfo rather than termcap */
  47. 			/* Should be defined for most SYSV, SVR4 (including
  48. 			 * Solaris 2+), HPUX, and Linux systems.  In
  49. 			 * particular, it should NOT be defined for the UNIXPC
  50. 			 * unless you remove the use of the shared library in
  51. 			 * the Makefile */
  52. #define TEXTCOLOR	/* Use System V r3.2 terminfo color support */
  53. 			/* and/or ANSI color support on termcap systems */
  54. 			/* and/or X11 color */
  55. #define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control */
  56. 			/* (e.g., VSUSP) */
  57. #define POSIX_TYPES	/* use POSIX types for system calls and termios */
  58. 			/* Define for many recent OS releases, including
  59. 			 * those with specific defines (since types are
  60. 			 * changing toward the standard from earlier chaos).
  61. 			 * For example, platforms using the GNU libraries,
  62. 			 * Linux, Solaris 2.x
  63. 			 */
  64.  
  65. /* #define OPENWINBUG */	/* avoid a problem using OpenWindows 3.0 for
  66. 				   X11 on SunOS 4.1.x, x>= 2.  Do not define
  67. 				   for other X11 implementations. */
  68. /* #define PYRAMID_BUG */	/* avoid a bug on the Pyramid */
  69. /* #define BSD_43_BUG */	/* for real 4.3BSD cc's without schain botch fix */
  70. /* #define MICROPORT_BUG */	/* problems with large arrays in structs */
  71. /* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to
  72. 				   run with Microport Sys V/AT version 2.4.
  73. 				   By Jay Maynard */
  74. /* #define AIXPS_2BUG */	/* avoid a problem with little_to_big() optimization */
  75.  
  76. /* #define RANDOM */		/* if neither random/srandom nor lrand48/srand48
  77. 				   is available from your system */
  78.  
  79. /* see sys/unix/snd86unx.shr for more information on these */
  80. /* #define UNIX386MUSIC */	/* play real music through speaker on systems
  81. 				   with music driver installed */
  82. /* #define VPIX_MUSIC */	/* play real music through speaker on systems
  83. 				   with built-in VPIX support */
  84.  
  85.  
  86. /*
  87. * The next two defines are intended mainly for the Andrew File System,
  88. * which does not allow hard links.  If NO_FILE_LINKS is defined, lock files
  89. * will be created in LOCKDIR using open() instead of in the playground using
  90. * link().
  91. *		Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88)
  92. */
  93.  
  94. /* #define NO_FILE_LINKS */	/* if no hard links */
  95. /* #define LOCKDIR "/usr/games/lib/nethackdir" */	/* where to put locks */
  96.  
  97. /*
  98. * If you want the static parts of your playground on a read-only file
  99. * system, define VAR_PLAYGROUND to be where the variable parts are kept.
  100. */
  101. /* #define VAR_PLAYGROUND "/var/lib/games/nethack" */
  102.  
  103.  
  104. /*
  105. * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
  106. * If defined, it can be overridden by the environment variable PAGER.
  107. * Hack will use its internal pager if DEF_PAGER is not defined.
  108. * (This might be preferable for security reasons.)
  109. * #define DEF_PAGER	".../mydir/mypager"
  110. */
  111.  
  112.  
  113.  
  114. /*
  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.
  119. */
  120. /* #define PORT_HELP "Unixhelp" */
  121.  
  122. #ifdef TTY_GRAPHICS
  123. /*
  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.
  130. */
  131. /* #define TIMED_DELAY */	/* usleep() */
  132. #endif
  133.  
  134. /*
  135. * If you define MAIL, then the player will be notified of new mail
  136. * when it arrives.  If you also define DEF_MAILREADER then this will
  137. * be the default mail reader, and can be overridden by the environment
  138. * variable MAILREADER; otherwise an internal pager will be used.
  139. * A stat system call is done on the mailbox every MAILCKFREQ moves.
  140. */
  141.  
  142. #define MAIL			/* Deliver mail during the game */
  143.  
  144. /* The Andrew Message System does mail a little differently from normal
  145. * UNIX.  Mail is deposited in the user's own directory in ~/Mailbox
  146. * (another directory).  MAILBOX is the element that will be added on to
  147. * the user's home directory path to generate the Mailbox path - just in
  148. * case other Andrew sites do it differently from CMU.
  149. *
  150. *		dan lovinger
  151. *		dl2n+@andrew.cmu.edu (dec 19 1989)
  152. */
  153.  
  154. /* #define AMS */		/* use Andrew message system for mail */
  155.  
  156. /* NO_MAILREADER is for kerberos authenticating filesystems where it is
  157. * essentially impossible to securely exec child processes, like mail
  158. * readers, when the game is running under a special token.
  159. *
  160. *	       dan
  161. */
  162.  
  163. /* #define NO_MAILREADER */	/* have mail daemon just tell player of mail */
  164.  
  165. #ifdef	MAIL
  166. # if defined(BSD) || defined(ULTRIX)
  167. #  ifdef AMS
  168. #define AMS_MAILBOX	"/Mailbox"
  169. #  else
  170. #   if defined(__FreeBSD__) || defined(__OpenBSD__)
  171. #define DEF_MAILREADER	"/usr/bin/mail"
  172. #   else
  173. #define DEF_MAILREADER	"/usr/ucb/Mail"
  174. #   endif
  175. #  endif
  176. #else
  177. # if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX)
  178. #  if defined(M_XENIX)
  179. #define DEF_MAILREADER	"/usr/bin/mail"
  180. #  else
  181. #   ifdef __sgi
  182. #define DEF_MAILREADER	"/usr/sbin/Mail"
  183. #   else
  184. #define DEF_MAILREADER	"/usr/bin/mailx"
  185. #   endif
  186. #  endif
  187. # else
  188. #define DEF_MAILREADER	"/bin/mail"
  189. # endif
  190. #endif
  191.  
  192. #define MAILCKFREQ	50
  193. #endif	/* MAIL */
  194.  
  195.  
  196.  
  197. #ifdef COMPRESS
  198. /* Some implementations of compress need a 'quiet' option.
  199. * If you've got one of these versions, put -q here.
  200. * You can also include any other strange options your compress needs.
  201. * If you have a normal compress, just leave it commented out.
  202. */
  203. /* #define COMPRESS_OPTIONS "-q" */
  204. #endif
  205.  
  206. #define FCMASK	0660	/* file creation mask */
  207.  
  208.  
  209. /*
  210. * The remainder of the file should not need to be changed.
  211. */
  212.  
  213. #ifdef _AUX_SOURCE
  214. # ifdef AUX /* gcc ? */
  215. #  define _SYSV_SOURCE
  216. #  define _BSD_SOURCE
  217. #else
  218. #  define AUX
  219. # endif
  220. #endif /* _AUX_SOURCE */
  221.  
  222. #if defined(LINUX) || defined(bsdi)
  223. # ifndef POSIX_TYPES
  224. #  define POSIX_TYPES
  225. # endif
  226. # ifndef POSIX_JOB_CONTROL
  227. #  define POSIX_JOB_CONTROL
  228. # endif
  229. #endif
  230.  
  231. /*
  232. * BSD/ULTRIX systems are normally the only ones that can suspend processes.
  233. * Suspending NetHack processes cleanly should be easy to add to other systems
  234. * that have SIGTSTP in the Berkeley sense.  Currently the only such systems
  235. * known to work are HPUX and AIX 3.1; other systems will probably require
  236. * tweaks to unixtty.c and ioctl.c.
  237. *
  238. * POSIX defines a slightly different type of job control, which should be
  239. * equivalent for NetHack's purposes.  POSIX_JOB_CONTROL should work on
  240. * various recent SYSV versions (with possibly tweaks to unixtty.c again).
  241. */
  242. #ifndef POSIX_JOB_CONTROL
  243. # if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31)
  244. #  define BSD_JOB_CONTROL
  245. # else
  246. #  if defined(SVR4)
  247. #   define POSIX_JOB_CONTROL
  248. #  endif
  249. # endif
  250. #endif
  251. #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX)
  252. #define SUSPEND		/* let ^Z suspend the game */
  253. #endif
  254.  
  255.  
  256. #if defined(BSD) || defined(ULTRIX)
  257. #include <sys/time.h>
  258. #else
  259. #include <time.h>
  260. #endif
  261.  
  262. #define HLOCK	"perm"	/* an empty file used for locking purposes */
  263.  
  264. #ifndef REDO
  265. #define Getchar nhgetch
  266. #endif
  267. #define tgetch getchar
  268.  
  269. #define SHELL		/* do not delete the '!' command */
  270.  
  271. #include "system.h"
  272.  
  273. #if defined(POSIX_TYPES) || defined(__GNUC__)
  274. #include <stdlib.h>
  275. #include <unistd.h>
  276. #endif
  277.  
  278. #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) || defined(ULTRIX)
  279. #include <sys/wait.h>
  280. #endif
  281.  
  282. #if defined(BSD) || defined(ULTRIX)
  283. # if !defined(DGUX) && !defined(SUNOS4)
  284. #define memcpy(d, s, n)		bcopy(s, d, n)
  285. #define memcmp(s1, s2, n)	bcmp(s2, s1, n)
  286. # endif
  287. # ifdef SUNOS4
  288. #include <memory.h>
  289. # endif
  290. #else	/* therefore SYSV */
  291. # ifndef index	/* some systems seem to do this for you */
  292. #define index	strchr
  293. # endif
  294. # ifndef rindex
  295. #define rindex	strrchr
  296. # endif
  297. #endif
  298.  
  299. /* Use the high quality random number routines. */
  300. #if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) || defined(RANDOM) || defined(__APPLE__)
  301. #define Rand()	random()
  302. #else
  303. #define Rand()	lrand48()
  304. #endif
  305.  
  306. #ifdef TIMED_DELAY
  307. # if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX))
  308. # define msleep(k) usleep((k)*1000)
  309. # endif
  310. # ifdef ULTRIX
  311. # define msleep(k) napms(k)
  312. # endif
  313. #endif
  314.  
  315. #ifdef hc	/* older versions of the MetaWare High-C compiler define this */
  316. # ifdef __HC__
  317. #  undef __HC__
  318. # endif
  319. # define __HC__ hc
  320. # undef hc
  321. #endif
  322.  
  323. #if defined(GNOME_GRAPHICS)
  324. #if defined(LINUX)
  325. # include <linux/unistd.h>
  326. # if defined(__NR_getresuid) && defined(__NR_getresgid)	/* ie., >= v2.1.44 */
  327. #  define GETRES_SUPPORT
  328. # endif
  329. #else
  330. # if defined(BSD) || defined(SVR4)
  331. /*
  332. * [ALI] We assume that SVR4 means we can safely include syscall.h
  333. * (although it's really a BSDism). This is certainly true for Solaris 2.5,
  334. * Solaris 7, Solaris 8 and Compaq Tru64 5.1
  335. * Later BSD systems will have the getresid system calls.
  336. */
  337. # include <sys/syscall.h>
  338. # if (defined (SYS_getuid) || defined(SYS_getresuid)) && \
  339. (defined(SYS_getgid) || defined(SYS_getresgid))
  340. #  define GETRES_SUPPORT
  341. # endif
  342. # endif	/* BSD || SVR4 */
  343. #endif /* LINUX */
  344. #endif	/* GNOME_GRAPHICS */
  345.  
  346. #endif /* UNIXCONF_H */
  347. #endif /* UNIX */