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