Source:NetHack 5.0.0/include/unixconf.h
Jump to navigation
Jump to search
Below is the full text to unixconf.h from the source code of NetHack 5.0.0. To link to a particular line, write [[Source:NetHack 5.0.0/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 5.0 unixconf.h $NHDT-Date: 1711213886 2024/03/23 17:11:26 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.57 $ */ 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 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 66. */ 67. 68. /* #define RANDOM */ /* if neither random/srandom nor lrand48/srand48 69. is available from your system */ 70. 71. /* 72. * The next two defines are intended mainly for the Andrew File System, 73. * which does not allow hard links. If NO_FILE_LINKS is defined, lock files 74. * will be created in LOCKDIR using open() instead of in the playground using 75. * link(). 76. * Ralf Brown, 7/26/89 (from v2.3 hack of 10/10/88) 77. */ 78. 79. /* #define NO_FILE_LINKS */ /* if no hard links */ 80. /* #define LOCKDIR "/usr/games/lib/nethackdir" */ /* where to put locks */ 81. 82. /* 83. * If you want the static parts of your playground on a read-only file 84. * system, define VAR_PLAYGROUND to be where the variable parts are kept. 85. */ 86. /* #define VAR_PLAYGROUND "/var/lib/games/nethack" */ 87. 88. /* 89. * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more" 90. * If defined, it can be overridden by the environment variable PAGER. 91. * NetHack will use its internal pager if DEF_PAGER is not defined _or_ 92. * if DLB is defined since an external pager won't know how to access the 93. * contents of the dlb container file. 94. * (Note: leaving DEF_PAGER undefined is preferable for security reasons.) 95. */ 96. /* #define DEF_PAGER "/usr/bin/less" */ 97. 98. /* 99. * Define PORT_HELP to be the name of the port-specific help file. 100. * This file is found in HACKDIR. 101. * Normally, you shouldn't need to change this. 102. * There is currently no port-specific help for Unix systems. 103. */ 104. /* #define PORT_HELP "Unixhelp" */ 105. 106. #ifdef TTY_GRAPHICS 107. /* 108. * To enable the `timed_delay' option for using a timer rather than extra 109. * screen output when pausing for display effect. Requires that `msleep' 110. * function be available (with time argument specified in milliseconds). 111. * Various output devices can produce wildly varying delays when the 112. * "extra output" method is used, but not all systems provide access to 113. * a fine-grained timer. 114. */ 115. /* #define TIMED_DELAY */ /* usleep() */ 116. #endif 117. #if defined(MACOS) && !defined(TIMED_DELAY) 118. #define TIMED_DELAY 119. #endif 120. 121. /* 122. * At start of game, if there are lock and level files for current 123. * character in the playground directory, ask whether to recover them 124. * (into a save file). 125. */ 126. /* #define SELF_RECOVER */ 127. 128. /* 129. * At start of game, if there is no save file to restore or lock and 130. * level files to recover but there is a panic save file for the current 131. * character, tell the player that it exists and ask whether to start a 132. * new game. Does not attempt to rename and restore the panic save file. 133. */ 134. #define CHECK_PANIC_SAVE 135. 136. /* #define AVOID_WIN_IOCTL */ /* ensure USE_WIN_IOCTL remains undefined */ 137. 138. /* 139. * If you define MAIL, then the player will be notified of new mail 140. * when it arrives. If you also define DEF_MAILREADER then this will 141. * be the default mail reader, and can be overridden by the environment 142. * variable MAILREADER; otherwise an internal pager will be used. 143. * A stat system call is done on the mailbox every MAILCKFREQ moves. 144. */ 145. #if !defined(NOMAIL) 146. #define MAIL /* Deliver mail during the game */ 147. #endif 148. 149. /* The Andrew Message System does mail a little differently from normal 150. * UNIX. Mail is deposited in the user's own directory in ~/Mailbox 151. * (another directory). MAILBOX is the element that will be added on to 152. * the user's home directory path to generate the Mailbox path - just in 153. * case other Andrew sites do it differently from CMU. 154. * dan lovinger 155. * dl2n+@andrew.cmu.edu (dec 19 1989) 156. */ 157. 158. /* #define AMS */ /* use Andrew message system for mail */ 159. 160. /* NO_MAILREADER is for kerberos authenticating filesystems where it is 161. * essentially impossible to securely exec child processes, like mail 162. * readers, when the game is running under a special token. 163. * dan 164. */ 165. 166. /* #define NO_MAILREADER */ /* have mail daemon just tell player of mail */ 167. 168. #ifdef MAIL 169. #if defined(BSD) || defined(ULTRIX) 170. #ifdef AMS 171. #define AMS_MAILBOX "/Mailbox" 172. #else 173. #if defined(__FreeBSD__) || defined(__OpenBSD__) 174. #define DEF_MAILREADER "/usr/bin/mail" 175. #else 176. #define DEF_MAILREADER "/usr/ucb/Mail" 177. #endif 178. #endif 179. #else 180. #if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX) 181. #if defined(M_XENIX) 182. #define DEF_MAILREADER "/usr/bin/mail" 183. #else 184. #ifdef __sgi 185. #define DEF_MAILREADER "/usr/sbin/Mail" 186. #else 187. #define DEF_MAILREADER "/usr/bin/mailx" 188. #endif 189. #endif 190. #else 191. #define DEF_MAILREADER "/bin/mail" 192. #endif 193. #endif 194. 195. /* If SIMPLE_MAIL is defined, the mail spool file format is 196. "sender:message", one mail per line, and mails are 197. read within game, from demon-delivered mail scrolls. 198. The mail spool file will be deleted once the player 199. has read the message. */ 200. /* #define SIMPLE_MAIL */ 201. 202. #ifndef MAILCKFREQ 203. /* How often mail spool file is checked for new messages, in turns */ 204. #define MAILCKFREQ 50 205. #endif 206. 207. #endif /* MAIL */ 208. 209. /* If SERVER_ADMIN_MSG is defined and the file exists, players get 210. a message from the user defined in the file. The file format 211. is "sender:message" all in one line. */ 212. /* #define SERVER_ADMIN_MSG "adminmsg" */ 213. #ifndef SERVER_ADMIN_MSG_CKFREQ 214. /* How often admin message file is checked for new messages, in turns */ 215. #define SERVER_ADMIN_MSG_CKFREQ 25 216. #endif 217. 218. 219. /* 220. * Some terminals or terminal emulators send two character sequence "ESC c" 221. * when Alt+c is pressed. The altmeta run-time option allows the user to 222. * request that "ESC c" be treated as M-c. 223. */ 224. #define ALTMETA /* support altmeta run-time option */ 225. 226. #ifdef COMPRESS 227. /* Some implementations of compress need a 'quiet' option. 228. * If you've got one of these versions, put -q here. 229. * You can also include any other strange options your compress needs. 230. * If you have a normal compress, just leave it commented out. 231. */ 232. /* #define COMPRESS_OPTIONS "-q" */ 233. #endif 234. 235. #ifndef FCMASK 236. #define FCMASK 0660 /* file creation mask */ 237. #endif 238. 239. /* fcntl(2) is a POSIX-portable call for manipulating file descriptors. 240. * Comment out the USE_FCNTL if for some reason you have a strange 241. * OS/filesystem combination for which fcntl(2) does not work. */ 242. #ifdef POSIX_TYPES 243. #define USE_FCNTL 244. #endif 245. 246. /* 247. * The remainder of the file should not need to be changed. 248. */ 249. 250. #ifdef _AUX_SOURCE 251. #ifdef AUX /* gcc ? */ 252. #define _SYSV_SOURCE 253. #define _BSD_SOURCE 254. #else 255. #define AUX 256. #endif 257. #endif /* _AUX_SOURCE */ 258. 259. #if defined(LINUX) || defined(bsdi) 260. #ifndef POSIX_TYPES 261. #define POSIX_TYPES 262. #endif 263. #ifndef POSIX_JOB_CONTROL 264. #define POSIX_JOB_CONTROL 265. #endif 266. #endif 267. 268. /* 269. * BSD/ULTRIX systems are normally the only ones that can suspend processes. 270. * Suspending NetHack processes cleanly should be easy to add to other systems 271. * that have SIGTSTP in the Berkeley sense. Currently the only such systems 272. * known to work are HPUX and AIX 3.1; other systems will probably require 273. * tweaks to unixtty.c and ioctl.c. 274. * 275. * POSIX defines a slightly different type of job control, which should be 276. * equivalent for NetHack's purposes. POSIX_JOB_CONTROL should work on 277. * various recent SYSV versions (with possibly tweaks to unixtty.c again). 278. */ 279. #ifndef POSIX_JOB_CONTROL 280. #if defined(BSD) || defined(ULTRIX) || defined(HPUX) || defined(AIX_31) 281. #define BSD_JOB_CONTROL 282. #else 283. #if defined(SVR4) 284. #define POSIX_JOB_CONTROL 285. #endif 286. #endif 287. #endif 288. 289. #ifndef NOSUSPEND 290. #if defined(BSD_JOB_CONTROL) || defined(POSIX_JOB_CONTROL) || defined(AUX) 291. #define SUSPEND /* let ^Z suspend the game (push to background) */ 292. #endif 293. #endif 294. 295. /* 296. * Define SAFERHANGUP to delay hangup processing until the main command 297. * loop. 'safer' because it avoids certain cheats and also avoids losing 298. * objects being thrown when the hangup occurs. All unix windowports 299. * support SAFERHANGUP (couldn't define it here otherwise). 300. */ 301. #define SAFERHANGUP 302. 303. #if defined(BSD) || defined(ULTRIX) 304. #include <sys/time.h> 305. #endif 306. 307. /* these might be needed for include/system.h; 308. default comes from system's time.h */ 309. /* #define NEED_TIME_DECL 1 */ 310. /* #define NEED_LOCALTIME_DECL 1 */ 311. /* #define NEED_CTIME_DECL 1 */ 312. /* these might be needed for src/hacklib.c; 313. default is 'time_t *' */ 314. /* #define TIME_type long * */ 315. /* #define LOCALTIME_type long * */ 316. 317. #define HLOCK "perm" /* an empty file used for locking purposes */ 318. 319. #define tgetch getchar 320. 321. #ifndef NOSHELL 322. #define SHELL /* do not delete the '!' command */ 323. #endif 324. 325. #if defined(POSIX_TYPES) || defined(__GNUC__) 326. #include <unistd.h> 327. #endif 328. 329. #if defined(POSIX_TYPES) || defined(__GNUC__) || defined(BSD) \ 330. || defined(ULTRIX) 331. #include <sys/wait.h> 332. #endif 333. 334. #if defined(BSD) || defined(ULTRIX) 335. #if !defined(DGUX) && !defined(SUNOS4) 336. #define memcpy(d, s, n) bcopy(s, d, n) 337. #define memcmp(s1, s2, n) bcmp(s2, s1, n) 338. #endif 339. #ifdef SUNOS4 340. #include <memory.h> 341. #endif 342. #else /* therefore SYSV */ 343. #ifdef NOT_C99 344. #ifndef index /* some systems seem to do this for you */ 345. #define index strchr 346. #endif 347. #ifndef rindex 348. #define rindex strrchr 349. #endif 350. #endif /* NOT_C99 */ 351. #endif /* SYSV */ 352. 353. /* Use the high quality random number routines. */ 354. /* the high quality random number routines */ 355. #ifndef USE_ISAAC64 356. # if defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) \ 357. || defined(RANDOM) || defined(MACOS) 358. # define Rand() random() 359. # else 360. # define Rand() lrand48() 361. # endif 362. #endif 363. 364. #ifdef TIMED_DELAY 365. #if defined(SUNOS4) || defined(LINUX) || (defined(BSD) && !defined(ULTRIX)) 366. #define msleep(k) usleep((k) *1000) 367. #endif 368. #ifdef ULTRIX 369. #define msleep(k) napms(k) 370. #endif 371. #endif 372. 373. /* Relevant for some systems: some older versions 374. of curses (the run-time library optionally used by nethack's tty 375. interface in addition to its curses interface) supply 'has_colors()' 376. but corresponding <curses.h> doesn't declare it. has_colors() is used 377. in unixtty.c by init_sco_cons() and init_linux_cons(). If the compiler 378. complains about has_colors() not being declared, try uncommenting 379. NEED_HAS_COLORS_DECL. If the linker complains about has_colors not 380. being found, switch to ncurses() or update to newer version of curses. */ 381. /* #define NEED_HAS_COLORS_DECL */ 382. 383. #ifdef hc /* older versions of the MetaWare High-C compiler define this */ 384. #ifdef __HC__ 385. #undef __HC__ 386. #endif 387. #define __HC__ hc 388. #undef hc 389. #endif 390. 391. #if defined(GNOME_GRAPHICS) 392. #if defined(LINUX) 393. #include <linux/unistd.h> 394. #if defined(__NR_getresuid) && defined(__NR_getresgid) /* ie., >= v2.1.44 */ 395. #define GETRES_SUPPORT 396. #endif 397. #else 398. #if defined(BSD) || defined(SVR4) 399. /* 400. * [ALI] We assume that SVR4 means we can safely include syscall.h 401. * (although it's really a BSDism). This is certainly true for Solaris 2.5, 402. * Solaris 7, Solaris 8 and Compaq Tru64 5.1 403. * Later BSD systems will have the getresid system calls. 404. */ 405. #include <sys/syscall.h> 406. #if (defined(SYS_getuid) || defined(SYS_getresuid)) \ 407. && (defined(SYS_getgid) || defined(SYS_getresgid)) 408. #define GETRES_SUPPORT 409. #endif 410. #endif /* BSD || SVR4 */ 411. #endif /* LINUX */ 412. #endif /* GNOME_GRAPHICS */ 413. 414. #if defined(MACOS) && !defined(LIBNH) 415. # define RUNTIME_PASTEBUF_SUPPORT 416. #endif 417. 418. /* 419. * /dev/random is blocking on Linux, so there we default to /dev/urandom which 420. * should still be good enough. 421. * BSD systems usually have /dev/random that is supposed to be used. 422. * OSX is based on NetBSD kernel and has both /dev/random and /dev/urandom. 423. */ 424. #ifdef LINUX 425. # define DEV_RANDOM "/dev/urandom" 426. #else 427. # if defined(BSD) || defined(MACOS) 428. # define DEV_RANDOM "/dev/random" 429. # endif 430. #endif 431. 432. #endif /* UNIXCONF_H */ 433. #endif /* UNIX */