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