xref: /dragonfly/games/hack/config.h (revision 2b57e6df)
1 /*	$NetBSD: config.h,v 1.10 2011/08/06 19:53:24 dholland 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  *
79  * Also, the code for suspend and various ioctls is only given for BSD4.2
80  * (I do not have access to a SYSV system.)
81  */
82 #define BSD		/* delete this line on System V */
83 
84 /* #define STUPID */	/* avoid some complicated expressions if
85 			   your C compiler chokes on them */
86 
87 #define WIZARD  "bruno"	/* the person allowed to use the -D option */
88 #define RECORD	"record"/* the file containing the list of topscorers */
89 #define	NEWS	"news"	/* the file containing the latest hack news */
90 #define	HELP	"help"	/* the file containing a description of the commands */
91 #define	SHELP	"hh"	/* abbreviated form of the same */
92 #define	RUMORFILE	"rumors"	/* a file with fortune cookies */
93 #define	DATAFILE	"data"	/* a file giving the meaning of symbols used */
94 #define	FMASK	0660	/* file creation mask */
95 #define	HLOCK	"perm"	/* an empty file used for locking purposes */
96 #define LLOCK	"safelock"	/* link to previous */
97 
98 #ifdef UNIX
99 /*
100  * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
101  * If defined, it can be overridden by the environment variable PAGER.
102  * Hack will use its internal pager if DEF_PAGER is not defined.
103  * (This might be preferable for security reasons.)
104  * #define DEF_PAGER	".../mydir/mypager"
105  */
106 
107 /*
108  * If you define MAIL, then the player will be notified of new mail
109  * when it arrives. If you also define DEF_MAILREADER then this will
110  * be the default mail reader, and can be overridden by the environment
111  * variable MAILREADER; otherwise an internal pager will be used.
112  * A stat system call is done on the mailbox every MAILCKFREQ moves.
113  */
114 /* #define	MAIL */
115 #define	DEF_MAILREADER	_PATH_MAIL		/* or e.g. /bin/mail */
116 #define	MAILCKFREQ	100
117 
118 
119 #define SHELL		/* do not delete the '!' command */
120 
121 #ifdef BSD
122 #define	SUSPEND		/* let ^Z suspend the game */
123 #endif /* BSD */
124 #endif /* UNIX */
125 
126 #ifdef CHDIR
127 /*
128  * If you define HACKDIR, then this will be the default playground;
129  * otherwise it will be the current directory.
130  */
131 #ifdef QUEST
132 #define HACKDIR _PATH_QUEST
133 #else /* QUEST */
134 #define HACKDIR	_PATH_HACK
135 #endif /* QUEST */
136 
137 /*
138  * Some system administrators are stupid enough to make Hack suid root
139  * or suid daemon, where daemon has other powers besides that of reading or
140  * writing Hack files. In such cases one should be careful with chdir's
141  * since the user might create files in a directory of his choice.
142  * Of course SECURE is meaningful only if HACKDIR is defined.
143  */
144 #define SECURE			/* do setuid(getuid()) after chdir() */
145 
146 /*
147  * If it is desirable to limit the number of people that can play Hack
148  * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS.
149  * #define MAX_NR_OF_PLAYERS	100
150  */
151 #endif /* CHDIR */
152 
153 /* size of terminal screen is (at least) (ROWNO+2) by COLNO */
154 #define	COLNO	80
155 #define	ROWNO	22
156 
157 /*
158  * small signed integers (8 bits suffice)
159  *	typedef	char	schar;
160  * will do when you have signed characters; otherwise use
161  *	typedef	short int schar;
162  *
163  * Use short chars anyway to avoid warnings.
164  */
165 #if 1
166 typedef	short int	schar;
167 #else
168 typedef	char		schar;
169 #endif
170 
171 /*
172  * small unsigned integers (8 bits suffice - but 7 bits do not)
173  * - these are usually object types; be careful with inequalities! -
174  *	typedef	unsigned char	uchar;
175  * will be satisfactory if you have an "unsigned char" type; otherwise use
176  *	typedef unsigned short int uchar;
177  */
178 typedef	unsigned char	uchar;
179 
180 /*
181  * small integers in the range 0 - 127, usually coordinates
182  * although they are nonnegative they must not be declared unsigned
183  * since otherwise comparisons with signed quantities are done incorrectly
184  */
185 typedef schar	xchar;
186 typedef	xchar	boolean;		/* 0 or 1 */
187 #define	TRUE	1
188 #define	FALSE	0
189 
190 /*
191  * Declaration of bitfields in various structs; if your C compiler
192  * doesnt handle bitfields well, e.g., if it is unable to initialize
193  * structs containing bitfields, then you might use
194  *	#define Bitfield(x,n)	uchar x
195  * since the bitfields used never have more than 7 bits. (Most have 1 bit.)
196  */
197 #define	Bitfield(x,n)	unsigned x:n
198 
199 #define	SIZE(x)	(int)(sizeof(x) / sizeof(x[0]))
200 
201 #endif /* CONFIG */
202