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