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