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