config.h revision 1.1 1 1.1 cgd /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
2 1.1 cgd /* config.h - version 1.0.3 */
3 1.1 cgd
4 1.1 cgd #include "pathnames.h"
5 1.1 cgd
6 1.1 cgd #ifndef CONFIG /* make sure the compiler doesnt see the typedefs twice */
7 1.1 cgd
8 1.1 cgd #define CONFIG
9 1.1 cgd #define UNIX /* delete if no fork(), exec() available */
10 1.1 cgd #define CHDIR /* delete if no chdir() available */
11 1.1 cgd
12 1.1 cgd /*
13 1.1 cgd * Some include files are in a different place under SYSV
14 1.1 cgd * BSD SYSV
15 1.1 cgd * <sys/wait.h> <wait.h>
16 1.1 cgd * <sys/time.h> <time.h>
17 1.1 cgd * <sgtty.h> <termio.h>
18 1.1 cgd * Some routines are called differently
19 1.1 cgd * index strchr
20 1.1 cgd * rindex strrchr
21 1.1 cgd * Also, the code for suspend and various ioctls is only given for BSD4.2
22 1.1 cgd * (I do not have access to a SYSV system.)
23 1.1 cgd */
24 1.1 cgd #define BSD /* delete this line on System V */
25 1.1 cgd
26 1.1 cgd /* #define STUPID */ /* avoid some complicated expressions if
27 1.1 cgd your C compiler chokes on them */
28 1.1 cgd /* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */
29 1.1 cgd /* #define NOWAITINCLUDE */ /* neither <wait.h> nor <sys/wait.h> exists */
30 1.1 cgd
31 1.1 cgd #define WIZARD "bruno" /* the person allowed to use the -D option */
32 1.1 cgd #define RECORD "record"/* the file containing the list of topscorers */
33 1.1 cgd #define NEWS "news" /* the file containing the latest hack news */
34 1.1 cgd #define HELP "help" /* the file containing a description of the commands */
35 1.1 cgd #define SHELP "hh" /* abbreviated form of the same */
36 1.1 cgd #define RUMORFILE "rumors" /* a file with fortune cookies */
37 1.1 cgd #define DATAFILE "data" /* a file giving the meaning of symbols used */
38 1.1 cgd #define FMASK 0660 /* file creation mask */
39 1.1 cgd #define HLOCK "perm" /* an empty file used for locking purposes */
40 1.1 cgd #define LLOCK "safelock" /* link to previous */
41 1.1 cgd
42 1.1 cgd #ifdef UNIX
43 1.1 cgd /*
44 1.1 cgd * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
45 1.1 cgd * If defined, it can be overridden by the environment variable PAGER.
46 1.1 cgd * Hack will use its internal pager if DEF_PAGER is not defined.
47 1.1 cgd * (This might be preferable for security reasons.)
48 1.1 cgd * #define DEF_PAGER ".../mydir/mypager"
49 1.1 cgd */
50 1.1 cgd
51 1.1 cgd /*
52 1.1 cgd * If you define MAIL, then the player will be notified of new mail
53 1.1 cgd * when it arrives. If you also define DEF_MAILREADER then this will
54 1.1 cgd * be the default mail reader, and can be overridden by the environment
55 1.1 cgd * variable MAILREADER; otherwise an internal pager will be used.
56 1.1 cgd * A stat system call is done on the mailbox every MAILCKFREQ moves.
57 1.1 cgd */
58 1.1 cgd /* #define MAIL */
59 1.1 cgd #define DEF_MAILREADER _PATH_MAIL /* or e.g. /bin/mail */
60 1.1 cgd #define MAILCKFREQ 100
61 1.1 cgd
62 1.1 cgd
63 1.1 cgd #define SHELL /* do not delete the '!' command */
64 1.1 cgd
65 1.1 cgd #ifdef BSD
66 1.1 cgd #define SUSPEND /* let ^Z suspend the game */
67 1.1 cgd #endif BSD
68 1.1 cgd #endif UNIX
69 1.1 cgd
70 1.1 cgd #ifdef CHDIR
71 1.1 cgd /*
72 1.1 cgd * If you define HACKDIR, then this will be the default playground;
73 1.1 cgd * otherwise it will be the current directory.
74 1.1 cgd */
75 1.1 cgd #ifdef QUEST
76 1.1 cgd #define HACKDIR _PATH_QUEST
77 1.1 cgd #else QUEST
78 1.1 cgd #define HACKDIR _PATH_HACK
79 1.1 cgd #endif QUEST
80 1.1 cgd
81 1.1 cgd /*
82 1.1 cgd * Some system administrators are stupid enough to make Hack suid root
83 1.1 cgd * or suid daemon, where daemon has other powers besides that of reading or
84 1.1 cgd * writing Hack files. In such cases one should be careful with chdir's
85 1.1 cgd * since the user might create files in a directory of his choice.
86 1.1 cgd * Of course SECURE is meaningful only if HACKDIR is defined.
87 1.1 cgd */
88 1.1 cgd #define SECURE /* do setuid(getuid()) after chdir() */
89 1.1 cgd
90 1.1 cgd /*
91 1.1 cgd * If it is desirable to limit the number of people that can play Hack
92 1.1 cgd * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS.
93 1.1 cgd * #define MAX_NR_OF_PLAYERS 100
94 1.1 cgd */
95 1.1 cgd #endif CHDIR
96 1.1 cgd
97 1.1 cgd /* size of terminal screen is (at least) (ROWNO+2) by COLNO */
98 1.1 cgd #define COLNO 80
99 1.1 cgd #define ROWNO 22
100 1.1 cgd
101 1.1 cgd /*
102 1.1 cgd * small signed integers (8 bits suffice)
103 1.1 cgd * typedef char schar;
104 1.1 cgd * will do when you have signed characters; otherwise use
105 1.1 cgd * typedef short int schar;
106 1.1 cgd */
107 1.1 cgd typedef char schar;
108 1.1 cgd
109 1.1 cgd /*
110 1.1 cgd * small unsigned integers (8 bits suffice - but 7 bits do not)
111 1.1 cgd * - these are usually object types; be careful with inequalities! -
112 1.1 cgd * typedef unsigned char uchar;
113 1.1 cgd * will be satisfactory if you have an "unsigned char" type; otherwise use
114 1.1 cgd * typedef unsigned short int uchar;
115 1.1 cgd */
116 1.1 cgd typedef unsigned char uchar;
117 1.1 cgd
118 1.1 cgd /*
119 1.1 cgd * small integers in the range 0 - 127, usually coordinates
120 1.1 cgd * although they are nonnegative they must not be declared unsigned
121 1.1 cgd * since otherwise comparisons with signed quantities are done incorrectly
122 1.1 cgd */
123 1.1 cgd typedef schar xchar;
124 1.1 cgd typedef xchar boolean; /* 0 or 1 */
125 1.1 cgd #define TRUE 1
126 1.1 cgd #define FALSE 0
127 1.1 cgd
128 1.1 cgd /*
129 1.1 cgd * Declaration of bitfields in various structs; if your C compiler
130 1.1 cgd * doesnt handle bitfields well, e.g., if it is unable to initialize
131 1.1 cgd * structs containing bitfields, then you might use
132 1.1 cgd * #define Bitfield(x,n) uchar x
133 1.1 cgd * since the bitfields used never have more than 7 bits. (Most have 1 bit.)
134 1.1 cgd */
135 1.1 cgd #define Bitfield(x,n) unsigned x:n
136 1.1 cgd
137 1.1 cgd #define SIZE(x) (int)(sizeof(x) / sizeof(x[0]))
138 1.1 cgd
139 1.1 cgd #endif CONFIG
140