Source:NetHack 3.6.5/include/unixconf.h
Jump to navigation
Jump to search
Below is the full text to unixconf.h from the source code of NetHack 3.6.5. To link to a particular line, write [[Source:NetHack 3.6.5/include/unixconf.h#line12]], for example.
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. /* NetHack 3.6 unixconf.h $NHDT-Date: 1555361298 2019/04/15 20:48:18 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.42 $ */ 2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ 3. /*-Copyright (c) Pasi Kallinen, 2018. */ 4. /* NetHack may be freely redistributed. See license for details. */ 5. 6. #ifdef UNIX 7. #ifndef UNIXCONF_H 8. #define UNIXCONF_H 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. /* define any of the following that are appropriate */ 35. #define SVR4 /* use in addition to SYSV for System V Release 4 */ 36. /* including Solaris 2+ */ 37. #define NETWORK /* if running on a networked system */ 38. /* e.g. Suns sharing a playground through NFS */ 39. /* #define SUNOS4 */ /* SunOS 4.x */ 40. #ifdef __linux__ 41. #define LINUX /* Another Unix clone */ 42. #endif 43. /* #define CYGWIN32 */ /* Unix on Win32 -- use with case sensitive defines */ 44. /* #define GENIX */ /* Yet Another Unix Clone */ 45. /* #define HISX */ /* Bull Unix for XPS Machines */ 46. /* #define BOS */ /* Bull Open Software - Unix for DPX/2 Machines */ 47. /* #define UNIXPC */ /* use in addition to SYSV for AT&T 7300/3B1 */ 48. /* #define AIX_31 */ /* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain 49. * job control (note that AIX is SYSV otherwise) 50. * Also define this for AIX 3.2 */ 51. 52. #define TERMINFO /* uses terminfo rather than termcap */ 53. /* Should be defined for most SYSV, SVR4 (including 54. * Solaris 2+), HPUX, and Linux systems. In 55. * particular, it should NOT be defined for the UNIXPC 56. * unless you remove the use of the shared library in 57. * the Makefile */ 58. #define TEXTCOLOR /* Use System V r3.2 terminfo color support 59. * and/or ANSI color support on termcap systems 60. * and/or X11 color. Note: if you get compiler 61. * warnings about 'has_colors()' being implicitly 62. * declared, uncomment NEED_HAS_COLORS_DECL below. */ 63. #define POSIX_JOB_CONTROL /* use System V / Solaris 2.x / POSIX job control 64. * (e.g., VSUSP) */ 65. #define POSIX_TYPES /* use POSIX types for system calls and termios */ 66. /* Define for many recent OS releases, including 67. * those with specific defines (since types are 68. * changing toward the standard from earlier chaos). 69. * For example, platforms using the GNU libraries, 70. * Linux, Solaris 2.x 71. */ 72. 73. /* #define OPENWINBUG */ /* avoid a problem using OpenWindows 3.0 for 74. X11 on SunOS 4.1.x, x>= 2. Do not define 75. for other X11 implementations. */ 76. /* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */ 77. /* #define BSD_43_BUG */ /* for real 4.3BSD cc's without schain botch fix */ 78. /* #define MICROPORT_BUG */ /* problems with large arrays in structs */ 79. /* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to 80. run with Microport Sys V/AT version 2.4. 81. By Jay Maynard */ 82. /* #define AIXPS_2BUG */ /* avoid a problem with little_to_big() optimization 83. */ 84. 85. /* #define RANDOM */ /* if neither random/srandom nor lrand48/srand48 86. is available from your system */ 87. 88. /* see sys/unix/snd86unx.shr for more information on these */ 89. /* #define UNIX386MUSIC */ /* play real music through speaker on systems 90. with music driver installed */ 91. /* #define VPIX_MUSIC */ /* play real music through speaker on systems 92. with built-in VPIX support */ 93. 94. /* 95. * The next two defines are intended mainly for the Andrew File System, 96. * which does not allow hard links. If NO_FILE_LINKS is defined, lock files 97. * will be created in LOCKDIR using open() instead of in the playground using 98. * link(). 99. * Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88) 100. */ 101. 102. /* #define NO_FILE_LINKS */ /* if no hard links */ 103. /* #define LOCKDIR "/usr/games/lib/nethackdir" */ /* where to put locks */ 104. 105. /* 106. * If you want the static parts of your playground on a read-only file 107. * system, define VAR_PLAYGROUND to be where the variable parts are kept. 108. */ 109. /* #define VAR_PLAYGROUND "/var/lib/games/nethack" */ 110. 111. /* 112. * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more" 113. * If defined, it can be overridden by the environment variable PAGER. 114. * Hack will use its internal pager if DEF_PAGER is not defined. 115. * (This might be preferable for security reasons.) 116. */ 117. /* #define DEF_PAGER ".../mydir/mypager" */ 118. 119. /* 120. * Define PORT_HELP to be the name of the port-specfic help file. 121. * This file is found in HACKDIR. 122. * Normally, you shouldn't need to change this. 123. * There is currently no port-specific help for Unix systems. 124. */ 125. /* #define PORT_HELP "Unixhelp" */ 126. 127. #ifdef TTY_GRAPHICS 128. /* 129. * To enable the `timed_delay' option for using a timer rather than extra 130. * screen output when pausing for display effect. Requires that `msleep' 131. * function be available (with time argument specified in milliseconds). 132. * Various output devices can produce wildly varying delays when the 133. * "extra output" method is used, but not all systems provide access to 134. * a fine-grained timer. 135. */ 136. /* #define TIMED_DELAY */ /* usleep() */ 137. #endif 138. #if defined(MACOSX) && !defined(TIMED_DELAY) 139. #define TIMED_DELAY 140. #endif 141. 142. /* #define AVOID_WIN_IOCTL */ /* ensure USE_WIN_IOCTL remains undefined */ 143. 144. /* 145. * If you define MAIL, then the player will be notified of new mail 146. * when it arrives. If you also define DEF_MAILREADER then this will 147. * be the default mail reader, and can be overridden by the environment 148. * variable MAILREADER; otherwise an internal pager will be used. 149. * A stat system call is done on the mailbox every MAILCKFREQ moves. 150. */ 151. #if !defined(NOMAIL) 152. #define MAIL /* Deliver mail during the game */ 153. #endif 154. 155. /* The Andrew Message System does mail a little differently from normal 156. * UNIX. Mail is deposited in the user's own directory in ~/Mailbox 157. * (another directory). MAILBOX is the element that will be added on to 158. * the user's home directory path to generate the Mailbox path - just in 159. * case other Andrew sites do it differently from CMU. 160. * dan lovinger 161. * dl2n+@andrew.cmu.edu (dec 19 1989) 162. */ 163. 164. /* #define AMS */ /* use Andrew message system for mail */ 165. 166. /* NO_MAILREADER is for kerberos authenticating filesystems where it is 167. * essentially impossible to securely exec child processes, like mail 168. * readers, when the game is running under a special token. 169. * dan 170. */ 171. 172. /* #define NO_MAILREADER */ /* have mail daemon just tell player of mail */ 173. 174. #ifdef MAIL 175. #if defined(BSD) || defined(ULTRIX) 176. #ifdef AMS 177. #define AMS_MAILBOX "/Mailbox" 178. #else 179. #if defined(__FreeBSD__) || defined(__OpenBSD__) 180. #define DEF_MAILREADER "/usr/bin/mail" 181. #else 182. #define DEF_MAILREADER "/usr/ucb/Mail" 183. #endif 184. #endif 185. #else 186. #if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX) 187. #if defined(M_XENIX) 188. #define DEF_MAILREADER "/usr/bin/mail" 189. #else 190. #ifdef __sgi 191. #define DEF_MAILREADER "/usr/sbin/Mail" 192. #else 193. #define DEF_MAILREADER "/usr/bin/mailx" 194. #endif 195. #endif 196. #else 197. #define DEF_MAILREADER "/bin/mail" 198. #endif 199. #endif 200. 201. /* If SIMPLE_MAIL is defined, the mail spool file format is 202. "sender:message", one mail per line, and mails are 203. read within game, from demon-delivered mail scrolls. 204. The mail spool file will be deleted once the player 205. has read the message. */ 206. /* #define SIMPLE_MAIL */ 207. 208. #ifndef MAILCKFREQ 209. /* How often mail spool file is checked for new messages, in turns */ 210. #define MAILCKFREQ 50 211. #endif 212. 213. #endif /* MAIL */ 214. 215. /* If SERVER_ADMIN_MSG is defined and the file exists, players get 216. a message from the user defined in the file. The file format 217. is "sender:message" all in one line. */ 218. /* #define SERVER_ADMIN_MSG "adminmsg" */ 219. #ifndef SERVER_ADMIN_MSG_CKFREQ 220. /* How often admin message file is checked for new messages, in turns */ 221. #define SERVER_ADMIN_MSG_CKFREQ 25 222. #endif 223. 224. 225. /* 226. * Some terminals or terminal emulators send two character sequence "ESC c" 227. * when Alt+c is pressed. The altmeta run-time option allows the user to 228. * request that "ESC c" be treated as M-c. 229. */ 230. #define ALTMETA /* support altmeta run-time option */ 231. 232. #ifdef COMPRESS 233. /* Some implementations of compress need a 'quiet' option. 234. * If you've got one of these versions, put -q here. 235. * You can also include any other strange options your compress needs. 236. * If you have a normal compress, just leave it commented out. 237. */ 238. /* #define COMPRESS_OPTIONS "-q" */ 239. #endif 240. 241. #ifndef FCMASK 242. #define FCMASK 0660 /* file creation mask */ 243. #endif 244. 245. /* fcntl(2) is a POSIX-portable call for manipulating file descriptors. 246. * Comment out the USE_FCNTL if for some reason you have a strange 247. * OS/filesystem combination for which fcntl(2) does not work. */ 248. #ifdef POSIX_TYPES 249. #define USE_FCNTL 250. #endif 251. 252. /* 253. * The remainder of the file should not need to be changed. 254. */ 255. 256. #ifdef _AUX_SOURCE 257. #ifdef AUX /* gcc ? */ 258. #define _SYSV_SOURCE 259. #define _BSD_SOURCE 260. #else 261. #define AUX 262. #endif 263. #endif /* _AUX_SOURCE */ 264. 265. #if defined(LINUX) || defined(bsdi) 266. #ifndef POSIX_TYPES 267. #define POSIX_TYPES 268. #endif 269. #ifndef POSIX_JOB_CONTROL 270. #define POSIX_JOB_CONTROL 271. #endif 272. #endif 273. 274. /* 275. * BSD/ULTRIX systems are normally the only ones that can suspend processes. 276. * Suspending NetHack processes cleanly should be easy to add to other systems 277. * that have SIGTSTP in the Berkeley sense. Currently the only such systems 278. * known to work are HPUX and AIX 3.1; other systems will probably require 279. * tweaks to unixtty.c and ioctl.c. 280. * 281. * POSIX defines a slightly different type of job control, which should be 282. * equivalent for NetHack's purposes. POSIX_JOB_CONTROL should work on 283. * various recent SYSV versions (with possibly tweaks to unixtty.c again). 284. */ 285. #ifndef POSIX_JOB_CONTROL 286. #if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31) 287. #define BSD_JOB_CONTROL 288. #else 289. #if defined(SVR4) 290. #define POSIX_JOB_CONTROL 291. #endif 292. #endif 293. #endif 294. #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX) 295. #define SUSPEND /* let ^Z suspend the game */ 296. #endif 297. 298. /* 299. * Define SAFERHANGUP to delay hangup processing until the main command 300. * loop. 'safer' because it avoids certain cheats and also avoids losing 301. * objects being thrown when the hangup occurs. All unix windowports 302. * support SAFERHANGUP (couldn't define it here otherwise). 303. */ 304. #define SAFERHANGUP 305. 306. #if defined(BSD) || defined(ULTRIX) 307. #include <sys/time.h> 308. #else 309. #include <time.h> 310. #endif 311. 312. #define HLOCK "perm" /* an empty file used for locking purposes */ 313. 314. #define tgetch getchar 315. 316. #ifndef NOSHELL 317. #define SHELL /* do not delete the '!' command */ 318. #endif 319. 320. #include "system.h" 321. 322. #if defined(POSIX_TYPES) || defined(__GNUC__) 323. #include <stdlib.h> 324. #include <unistd.h> 325. #endif 326. 327. #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) \ 328. || defined(ULTRIX) 329. #include <sys/wait.h> 330. #endif 331. 332. #if defined(BSD) || defined(ULTRIX) 333. #if !defined(DGUX) && !defined(SUNOS4) 334. #define memcpy(d, s, n) bcopy(s, d, n) 335. #define memcmp(s1, s2, n) bcmp(s2, s1, n) 336. #endif 337. #ifdef SUNOS4 338. #include <memory.h> 339. #endif 340. #else /* therefore SYSV */ 341. #ifndef index /* some systems seem to do this for you */ 342. #define index strchr 343. #endif 344. #ifndef rindex 345. #define rindex strrchr 346. #endif 347. #endif 348. 349. /* Use the high quality random number routines. */ 350. /* the high quality random number routines */ 351. #ifndef USE_ISAAC64 352. # if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \ 353. || defined(RANDOM) || defined(MACOSX) 354. # define Rand() random() 355. # else 356. # define Rand() lrand48() 357. # endif 358. #endif 359. 360. #ifdef TIMED_DELAY 361. #if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX)) 362. #define msleep(k) usleep((k) *1000) 363. #endif 364. #ifdef ULTRIX 365. #define msleep(k) napms(k) 366. #endif 367. #endif 368. 369. /* Relevant for some systems which enable TEXTCOLOR: some older versions 370. of curses (the run-time library optionally used by nethack's tty 371. interface in addition to its curses interface) supply 'has_colors()' 372. but corresponding <curses.h> doesn't declare it. has_colors() is used 373. in unixtty.c by init_sco_cons() and init_linux_cons(). If the compiler 374. complains about has_colors() not being declared, try uncommenting 375. NEED_HAS_COLORS_DECL. If the linker complains about has_colors not 376. being found, switch to ncurses() or update to newer version of curses. */ 377. /* #define NEED_HAS_COLORS_DECL */ 378. 379. #ifdef hc /* older versions of the MetaWare High-C compiler define this */ 380. #ifdef __HC__ 381. #undef __HC__ 382. #endif 383. #define __HC__ hc 384. #undef hc 385. #endif 386. 387. #if defined(GNOME_GRAPHICS) 388. #if defined(LINUX) 389. #include <linux/unistd.h> 390. #if defined(__NR_getresuid) && defined(__NR_getresgid) /* ie., >= v2.1.44 */ 391. #define GETRES_SUPPORT 392. #endif 393. #else 394. #if defined(BSD) || defined(SVR4) 395. /* 396. * [ALI] We assume that SVR4 means we can safely include syscall.h 397. * (although it's really a BSDism). This is certainly true for Solaris 2.5, 398. * Solaris 7, Solaris 8 and Compaq Tru64 5.1 399. * Later BSD systems will have the getresid system calls. 400. */ 401. #include <sys/syscall.h> 402. #if (defined(SYS_getuid) || defined(SYS_getresuid)) \ 403. && (defined(SYS_getgid) || defined(SYS_getresgid)) 404. #define GETRES_SUPPORT 405. #endif 406. #endif /* BSD || SVR4 */ 407. #endif /* LINUX */ 408. #endif /* GNOME_GRAPHICS */ 409. 410. #ifdef MACOSX 411. # define RUNTIME_PASTEBUF_SUPPORT 412. #endif 413. 414. /* 415. * /dev/random is blocking on Linux, so there we default to /dev/urandom which 416. * should still be good enough. 417. * BSD systems usually have /dev/random that is supposed to be used. 418. * OSX is based on NetBSD kernel and has both /dev/random and /dev/urandom. 419. */ 420. #ifdef LINUX 421. # define DEV_RANDOM "/dev/urandom" 422. #else 423. # if defined(BSD) || defined(MACOSX) 424. # define DEV_RANDOM "/dev/random" 425. # endif 426. #endif 427. 428. #endif /* UNIXCONF_H */ 429. #endif /* UNIX */