1 1.11 rillig /* $NetBSD: config.h,v 1.11 2021/05/02 12:50:44 rillig Exp $ */ 2 1.5 christos 3 1.2 mycroft /* 4 1.7 jsm * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, 5 1.7 jsm * Amsterdam 6 1.7 jsm * All rights reserved. 7 1.7 jsm * 8 1.7 jsm * Redistribution and use in source and binary forms, with or without 9 1.7 jsm * modification, are permitted provided that the following conditions are 10 1.7 jsm * met: 11 1.7 jsm * 12 1.7 jsm * - Redistributions of source code must retain the above copyright notice, 13 1.7 jsm * this list of conditions and the following disclaimer. 14 1.7 jsm * 15 1.7 jsm * - Redistributions in binary form must reproduce the above copyright 16 1.7 jsm * notice, this list of conditions and the following disclaimer in the 17 1.7 jsm * documentation and/or other materials provided with the distribution. 18 1.7 jsm * 19 1.7 jsm * - Neither the name of the Stichting Centrum voor Wiskunde en 20 1.7 jsm * Informatica, nor the names of its contributors may be used to endorse or 21 1.7 jsm * promote products derived from this software without specific prior 22 1.7 jsm * written permission. 23 1.7 jsm * 24 1.7 jsm * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 25 1.7 jsm * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 26 1.7 jsm * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 27 1.7 jsm * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 28 1.7 jsm * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 29 1.7 jsm * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 30 1.7 jsm * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 31 1.7 jsm * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 32 1.7 jsm * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 33 1.7 jsm * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 34 1.7 jsm * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 1.7 jsm */ 36 1.7 jsm 37 1.7 jsm /* 38 1.7 jsm * Copyright (c) 1982 Jay Fenlason <hack (at) gnu.org> 39 1.7 jsm * All rights reserved. 40 1.7 jsm * 41 1.7 jsm * Redistribution and use in source and binary forms, with or without 42 1.7 jsm * modification, are permitted provided that the following conditions 43 1.7 jsm * are met: 44 1.7 jsm * 1. Redistributions of source code must retain the above copyright 45 1.7 jsm * notice, this list of conditions and the following disclaimer. 46 1.7 jsm * 2. Redistributions in binary form must reproduce the above copyright 47 1.7 jsm * notice, this list of conditions and the following disclaimer in the 48 1.7 jsm * documentation and/or other materials provided with the distribution. 49 1.7 jsm * 3. The name of the author may not be used to endorse or promote products 50 1.7 jsm * derived from this software without specific prior written permission. 51 1.7 jsm * 52 1.7 jsm * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 53 1.7 jsm * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 54 1.7 jsm * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 55 1.7 jsm * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 56 1.7 jsm * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 57 1.7 jsm * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 58 1.7 jsm * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 59 1.7 jsm * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 60 1.7 jsm * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 61 1.7 jsm * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 62 1.2 mycroft */ 63 1.1 cgd 64 1.1 cgd #include "pathnames.h" 65 1.1 cgd 66 1.1 cgd #ifndef CONFIG /* make sure the compiler doesnt see the typedefs twice */ 67 1.1 cgd 68 1.1 cgd #define CONFIG 69 1.1 cgd #define UNIX /* delete if no fork(), exec() available */ 70 1.1 cgd #define CHDIR /* delete if no chdir() available */ 71 1.1 cgd 72 1.1 cgd /* 73 1.1 cgd * Some include files are in a different place under SYSV 74 1.1 cgd * BSD SYSV 75 1.1 cgd * <sys/wait.h> <wait.h> 76 1.1 cgd * <sys/time.h> <time.h> 77 1.1 cgd * <sgtty.h> <termio.h> 78 1.9 dholland * 79 1.1 cgd * Also, the code for suspend and various ioctls is only given for BSD4.2 80 1.1 cgd * (I do not have access to a SYSV system.) 81 1.1 cgd */ 82 1.1 cgd #define BSD /* delete this line on System V */ 83 1.1 cgd 84 1.1 cgd /* #define STUPID */ /* avoid some complicated expressions if 85 1.1 cgd your C compiler chokes on them */ 86 1.1 cgd 87 1.1 cgd #define WIZARD "bruno" /* the person allowed to use the -D option */ 88 1.1 cgd #define RECORD "record"/* the file containing the list of topscorers */ 89 1.1 cgd #define NEWS "news" /* the file containing the latest hack news */ 90 1.1 cgd #define HELP "help" /* the file containing a description of the commands */ 91 1.1 cgd #define SHELP "hh" /* abbreviated form of the same */ 92 1.1 cgd #define RUMORFILE "rumors" /* a file with fortune cookies */ 93 1.1 cgd #define DATAFILE "data" /* a file giving the meaning of symbols used */ 94 1.1 cgd #define FMASK 0660 /* file creation mask */ 95 1.1 cgd #define HLOCK "perm" /* an empty file used for locking purposes */ 96 1.1 cgd #define LLOCK "safelock" /* link to previous */ 97 1.1 cgd 98 1.1 cgd #ifdef UNIX 99 1.1 cgd /* 100 1.1 cgd * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more" 101 1.1 cgd * If defined, it can be overridden by the environment variable PAGER. 102 1.1 cgd * Hack will use its internal pager if DEF_PAGER is not defined. 103 1.1 cgd * (This might be preferable for security reasons.) 104 1.1 cgd * #define DEF_PAGER ".../mydir/mypager" 105 1.1 cgd */ 106 1.1 cgd 107 1.1 cgd /* 108 1.1 cgd * If you define MAIL, then the player will be notified of new mail 109 1.1 cgd * when it arrives. If you also define DEF_MAILREADER then this will 110 1.1 cgd * be the default mail reader, and can be overridden by the environment 111 1.1 cgd * variable MAILREADER; otherwise an internal pager will be used. 112 1.1 cgd * A stat system call is done on the mailbox every MAILCKFREQ moves. 113 1.1 cgd */ 114 1.1 cgd /* #define MAIL */ 115 1.1 cgd #define DEF_MAILREADER _PATH_MAIL /* or e.g. /bin/mail */ 116 1.11 rillig #define MAILCKFREQ 100 117 1.1 cgd 118 1.1 cgd 119 1.1 cgd #define SHELL /* do not delete the '!' command */ 120 1.1 cgd 121 1.1 cgd #ifdef BSD 122 1.1 cgd #define SUSPEND /* let ^Z suspend the game */ 123 1.6 cgd #endif /* BSD */ 124 1.6 cgd #endif /* UNIX */ 125 1.1 cgd 126 1.1 cgd #ifdef CHDIR 127 1.1 cgd /* 128 1.1 cgd * If you define HACKDIR, then this will be the default playground; 129 1.1 cgd * otherwise it will be the current directory. 130 1.1 cgd */ 131 1.1 cgd #ifdef QUEST 132 1.1 cgd #define HACKDIR _PATH_QUEST 133 1.6 cgd #else /* QUEST */ 134 1.1 cgd #define HACKDIR _PATH_HACK 135 1.6 cgd #endif /* QUEST */ 136 1.1 cgd 137 1.1 cgd /* 138 1.1 cgd * Some system administrators are stupid enough to make Hack suid root 139 1.1 cgd * or suid daemon, where daemon has other powers besides that of reading or 140 1.1 cgd * writing Hack files. In such cases one should be careful with chdir's 141 1.1 cgd * since the user might create files in a directory of his choice. 142 1.1 cgd * Of course SECURE is meaningful only if HACKDIR is defined. 143 1.1 cgd */ 144 1.1 cgd #define SECURE /* do setuid(getuid()) after chdir() */ 145 1.1 cgd 146 1.1 cgd /* 147 1.1 cgd * If it is desirable to limit the number of people that can play Hack 148 1.1 cgd * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS. 149 1.1 cgd * #define MAX_NR_OF_PLAYERS 100 150 1.1 cgd */ 151 1.6 cgd #endif /* CHDIR */ 152 1.1 cgd 153 1.1 cgd /* size of terminal screen is (at least) (ROWNO+2) by COLNO */ 154 1.1 cgd #define COLNO 80 155 1.1 cgd #define ROWNO 22 156 1.1 cgd 157 1.1 cgd /* 158 1.1 cgd * small signed integers (8 bits suffice) 159 1.1 cgd * typedef char schar; 160 1.1 cgd * will do when you have signed characters; otherwise use 161 1.1 cgd * typedef short int schar; 162 1.5 christos * 163 1.5 christos * Use short chars anyway to avoid warnings. 164 1.1 cgd */ 165 1.5 christos #if 1 166 1.4 thorpej typedef short int schar; 167 1.4 thorpej #else 168 1.4 thorpej typedef char schar; 169 1.4 thorpej #endif 170 1.1 cgd 171 1.1 cgd /* 172 1.1 cgd * small unsigned integers (8 bits suffice - but 7 bits do not) 173 1.1 cgd * - these are usually object types; be careful with inequalities! - 174 1.1 cgd * typedef unsigned char uchar; 175 1.1 cgd * will be satisfactory if you have an "unsigned char" type; otherwise use 176 1.1 cgd * typedef unsigned short int uchar; 177 1.1 cgd */ 178 1.1 cgd typedef unsigned char uchar; 179 1.1 cgd 180 1.1 cgd /* 181 1.1 cgd * small integers in the range 0 - 127, usually coordinates 182 1.1 cgd * although they are nonnegative they must not be declared unsigned 183 1.1 cgd * since otherwise comparisons with signed quantities are done incorrectly 184 1.1 cgd */ 185 1.1 cgd typedef schar xchar; 186 1.1 cgd typedef xchar boolean; /* 0 or 1 */ 187 1.1 cgd #define TRUE 1 188 1.1 cgd #define FALSE 0 189 1.1 cgd 190 1.1 cgd /* 191 1.1 cgd * Declaration of bitfields in various structs; if your C compiler 192 1.1 cgd * doesnt handle bitfields well, e.g., if it is unable to initialize 193 1.1 cgd * structs containing bitfields, then you might use 194 1.1 cgd * #define Bitfield(x,n) uchar x 195 1.1 cgd * since the bitfields used never have more than 7 bits. (Most have 1 bit.) 196 1.1 cgd */ 197 1.1 cgd #define Bitfield(x,n) unsigned x:n 198 1.1 cgd 199 1.1 cgd #define SIZE(x) (int)(sizeof(x) / sizeof(x[0])) 200 1.1 cgd 201 1.5 christos #endif /* CONFIG */ 202