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