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