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