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