config.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /* $NetBSD: config.h,v 1.7 2003/04/02 18:36:33 jsm Exp $ */
  2. /*
  3. * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
  4. * Amsterdam
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are
  9. * met:
  10. *
  11. * - Redistributions of source code must retain the above copyright notice,
  12. * this list of conditions and the following disclaimer.
  13. *
  14. * - Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the distribution.
  17. *
  18. * - Neither the name of the Stichting Centrum voor Wiskunde en
  19. * Informatica, nor the names of its contributors may be used to endorse or
  20. * promote products derived from this software without specific prior
  21. * written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  24. * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
  25. * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  26. * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  27. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  28. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  29. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  30. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  31. * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  32. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  33. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. */
  35. /*
  36. * Copyright (c) 1982 Jay Fenlason <hack@gnu.org>
  37. * All rights reserved.
  38. *
  39. * Redistribution and use in source and binary forms, with or without
  40. * modification, are permitted provided that the following conditions
  41. * are met:
  42. * 1. Redistributions of source code must retain the above copyright
  43. * notice, this list of conditions and the following disclaimer.
  44. * 2. Redistributions in binary form must reproduce the above copyright
  45. * notice, this list of conditions and the following disclaimer in the
  46. * documentation and/or other materials provided with the distribution.
  47. * 3. The name of the author may not be used to endorse or promote products
  48. * derived from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  51. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  52. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  53. * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  54. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  55. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  56. * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  57. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  58. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  59. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  60. */
  61. #include "pathnames.h"
  62. #ifndef CONFIG /* make sure the compiler doesnt see the typedefs twice */
  63. #define CONFIG
  64. #define UNIX /* delete if no fork(), exec() available */
  65. #define CHDIR /* delete if no chdir() available */
  66. /*
  67. * Some include files are in a different place under SYSV
  68. * BSD SYSV
  69. * <sys/wait.h> <wait.h>
  70. * <sys/time.h> <time.h>
  71. * <sgtty.h> <termio.h>
  72. * Some routines are called differently
  73. * index strchr
  74. * rindex strrchr
  75. * Also, the code for suspend and various ioctls is only given for BSD4.2
  76. * (I do not have access to a SYSV system.)
  77. */
  78. #define BSD /* delete this line on System V */
  79. /* #define STUPID */ /* avoid some complicated expressions if
  80. your C compiler chokes on them */
  81. /* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */
  82. /* #define NOWAITINCLUDE */ /* neither <wait.h> nor <sys/wait.h> exists */
  83. #define WIZARD "bruno" /* the person allowed to use the -D option */
  84. #define RECORD "record"/* the file containing the list of topscorers */
  85. #define NEWS "news" /* the file containing the latest hack news */
  86. #define HELP "help" /* the file containing a description of the commands */
  87. #define SHELP "hh" /* abbreviated form of the same */
  88. #define RUMORFILE "rumors" /* a file with fortune cookies */
  89. #define DATAFILE "data" /* a file giving the meaning of symbols used */
  90. #define FMASK 0660 /* file creation mask */
  91. #define HLOCK "perm" /* an empty file used for locking purposes */
  92. #define LLOCK "safelock" /* link to previous */
  93. #ifdef UNIX
  94. /*
  95. * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
  96. * If defined, it can be overridden by the environment variable PAGER.
  97. * Hack will use its internal pager if DEF_PAGER is not defined.
  98. * (This might be preferable for security reasons.)
  99. * #define DEF_PAGER ".../mydir/mypager"
  100. */
  101. /*
  102. * If you define MAIL, then the player will be notified of new mail
  103. * when it arrives. If you also define DEF_MAILREADER then this will
  104. * be the default mail reader, and can be overridden by the environment
  105. * variable MAILREADER; otherwise an internal pager will be used.
  106. * A stat system call is done on the mailbox every MAILCKFREQ moves.
  107. */
  108. /* #define MAIL */
  109. #define DEF_MAILREADER _PATH_MAIL /* or e.g. /bin/mail */
  110. #define MAILCKFREQ 100
  111. #define SHELL /* do not delete the '!' command */
  112. #ifdef BSD
  113. #define SUSPEND /* let ^Z suspend the game */
  114. #endif /* BSD */
  115. #endif /* UNIX */
  116. #ifdef CHDIR
  117. /*
  118. * If you define HACKDIR, then this will be the default playground;
  119. * otherwise it will be the current directory.
  120. */
  121. #ifdef QUEST
  122. #define HACKDIR _PATH_QUEST
  123. #else /* QUEST */
  124. #define HACKDIR _PATH_HACK
  125. #endif /* QUEST */
  126. /*
  127. * Some system administrators are stupid enough to make Hack suid root
  128. * or suid daemon, where daemon has other powers besides that of reading or
  129. * writing Hack files. In such cases one should be careful with chdir's
  130. * since the user might create files in a directory of his choice.
  131. * Of course SECURE is meaningful only if HACKDIR is defined.
  132. */
  133. #define SECURE /* do setuid(getuid()) after chdir() */
  134. /*
  135. * If it is desirable to limit the number of people that can play Hack
  136. * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS.
  137. * #define MAX_NR_OF_PLAYERS 100
  138. */
  139. #endif /* CHDIR */
  140. /* size of terminal screen is (at least) (ROWNO+2) by COLNO */
  141. #define COLNO 80
  142. #define ROWNO 22
  143. /*
  144. * small signed integers (8 bits suffice)
  145. * typedef char schar;
  146. * will do when you have signed characters; otherwise use
  147. * typedef short int schar;
  148. *
  149. * Use short chars anyway to avoid warnings.
  150. */
  151. #if 1
  152. typedef short int schar;
  153. #else
  154. typedef char schar;
  155. #endif
  156. /*
  157. * small unsigned integers (8 bits suffice - but 7 bits do not)
  158. * - these are usually object types; be careful with inequalities! -
  159. * typedef unsigned char uchar;
  160. * will be satisfactory if you have an "unsigned char" type; otherwise use
  161. * typedef unsigned short int uchar;
  162. */
  163. typedef unsigned char uchar;
  164. /*
  165. * small integers in the range 0 - 127, usually coordinates
  166. * although they are nonnegative they must not be declared unsigned
  167. * since otherwise comparisons with signed quantities are done incorrectly
  168. */
  169. typedef schar xchar;
  170. typedef xchar boolean; /* 0 or 1 */
  171. #define TRUE 1
  172. #define FALSE 0
  173. /*
  174. * Declaration of bitfields in various structs; if your C compiler
  175. * doesnt handle bitfields well, e.g., if it is unable to initialize
  176. * structs containing bitfields, then you might use
  177. * #define Bitfield(x,n) uchar x
  178. * since the bitfields used never have more than 7 bits. (Most have 1 bit.)
  179. */
  180. #define Bitfield(x,n) unsigned x:n
  181. #define SIZE(x) (int)(sizeof(x) / sizeof(x[0]))
  182. #endif /* CONFIG */