Home | History | Annotate | Line # | Download | only in hack
config.h revision 1.9
      1  1.9  dholland /*	$NetBSD: config.h,v 1.9 2011/08/06 19:47:54 dholland 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 /* #define NOWAITINCLUDE */	/* neither <wait.h> nor <sys/wait.h> exists */
     87  1.1       cgd 
     88  1.1       cgd #define WIZARD  "bruno"	/* the person allowed to use the -D option */
     89  1.1       cgd #define RECORD	"record"/* the file containing the list of topscorers */
     90  1.1       cgd #define	NEWS	"news"	/* the file containing the latest hack news */
     91  1.1       cgd #define	HELP	"help"	/* the file containing a description of the commands */
     92  1.1       cgd #define	SHELP	"hh"	/* abbreviated form of the same */
     93  1.1       cgd #define	RUMORFILE	"rumors"	/* a file with fortune cookies */
     94  1.1       cgd #define	DATAFILE	"data"	/* a file giving the meaning of symbols used */
     95  1.1       cgd #define	FMASK	0660	/* file creation mask */
     96  1.1       cgd #define	HLOCK	"perm"	/* an empty file used for locking purposes */
     97  1.1       cgd #define LLOCK	"safelock"	/* link to previous */
     98  1.1       cgd 
     99  1.1       cgd #ifdef UNIX
    100  1.1       cgd /*
    101  1.1       cgd  * Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
    102  1.1       cgd  * If defined, it can be overridden by the environment variable PAGER.
    103  1.1       cgd  * Hack will use its internal pager if DEF_PAGER is not defined.
    104  1.1       cgd  * (This might be preferable for security reasons.)
    105  1.1       cgd  * #define DEF_PAGER	".../mydir/mypager"
    106  1.1       cgd  */
    107  1.1       cgd 
    108  1.1       cgd /*
    109  1.1       cgd  * If you define MAIL, then the player will be notified of new mail
    110  1.1       cgd  * when it arrives. If you also define DEF_MAILREADER then this will
    111  1.1       cgd  * be the default mail reader, and can be overridden by the environment
    112  1.1       cgd  * variable MAILREADER; otherwise an internal pager will be used.
    113  1.1       cgd  * A stat system call is done on the mailbox every MAILCKFREQ moves.
    114  1.1       cgd  */
    115  1.1       cgd /* #define	MAIL */
    116  1.1       cgd #define	DEF_MAILREADER	_PATH_MAIL		/* or e.g. /bin/mail */
    117  1.1       cgd #define	MAILCKFREQ	100
    118  1.1       cgd 
    119  1.1       cgd 
    120  1.1       cgd #define SHELL		/* do not delete the '!' command */
    121  1.1       cgd 
    122  1.1       cgd #ifdef BSD
    123  1.1       cgd #define	SUSPEND		/* let ^Z suspend the game */
    124  1.6       cgd #endif /* BSD */
    125  1.6       cgd #endif /* UNIX */
    126  1.1       cgd 
    127  1.1       cgd #ifdef CHDIR
    128  1.1       cgd /*
    129  1.1       cgd  * If you define HACKDIR, then this will be the default playground;
    130  1.1       cgd  * otherwise it will be the current directory.
    131  1.1       cgd  */
    132  1.1       cgd #ifdef QUEST
    133  1.1       cgd #define HACKDIR _PATH_QUEST
    134  1.6       cgd #else /* QUEST */
    135  1.1       cgd #define HACKDIR	_PATH_HACK
    136  1.6       cgd #endif /* QUEST */
    137  1.1       cgd 
    138  1.1       cgd /*
    139  1.1       cgd  * Some system administrators are stupid enough to make Hack suid root
    140  1.1       cgd  * or suid daemon, where daemon has other powers besides that of reading or
    141  1.1       cgd  * writing Hack files. In such cases one should be careful with chdir's
    142  1.1       cgd  * since the user might create files in a directory of his choice.
    143  1.1       cgd  * Of course SECURE is meaningful only if HACKDIR is defined.
    144  1.1       cgd  */
    145  1.1       cgd #define SECURE			/* do setuid(getuid()) after chdir() */
    146  1.1       cgd 
    147  1.1       cgd /*
    148  1.1       cgd  * If it is desirable to limit the number of people that can play Hack
    149  1.1       cgd  * simultaneously, define HACKDIR, SECURE and MAX_NR_OF_PLAYERS.
    150  1.1       cgd  * #define MAX_NR_OF_PLAYERS	100
    151  1.1       cgd  */
    152  1.6       cgd #endif /* CHDIR */
    153  1.1       cgd 
    154  1.1       cgd /* size of terminal screen is (at least) (ROWNO+2) by COLNO */
    155  1.1       cgd #define	COLNO	80
    156  1.1       cgd #define	ROWNO	22
    157  1.1       cgd 
    158  1.1       cgd /*
    159  1.1       cgd  * small signed integers (8 bits suffice)
    160  1.1       cgd  *	typedef	char	schar;
    161  1.1       cgd  * will do when you have signed characters; otherwise use
    162  1.1       cgd  *	typedef	short int schar;
    163  1.5  christos  *
    164  1.5  christos  * Use short chars anyway to avoid warnings.
    165  1.1       cgd  */
    166  1.5  christos #if 1
    167  1.4   thorpej typedef	short int	schar;
    168  1.4   thorpej #else
    169  1.4   thorpej typedef	char		schar;
    170  1.4   thorpej #endif
    171  1.1       cgd 
    172  1.1       cgd /*
    173  1.1       cgd  * small unsigned integers (8 bits suffice - but 7 bits do not)
    174  1.1       cgd  * - these are usually object types; be careful with inequalities! -
    175  1.1       cgd  *	typedef	unsigned char	uchar;
    176  1.1       cgd  * will be satisfactory if you have an "unsigned char" type; otherwise use
    177  1.1       cgd  *	typedef unsigned short int uchar;
    178  1.1       cgd  */
    179  1.1       cgd typedef	unsigned char	uchar;
    180  1.1       cgd 
    181  1.1       cgd /*
    182  1.1       cgd  * small integers in the range 0 - 127, usually coordinates
    183  1.1       cgd  * although they are nonnegative they must not be declared unsigned
    184  1.1       cgd  * since otherwise comparisons with signed quantities are done incorrectly
    185  1.1       cgd  */
    186  1.1       cgd typedef schar	xchar;
    187  1.1       cgd typedef	xchar	boolean;		/* 0 or 1 */
    188  1.1       cgd #define	TRUE	1
    189  1.1       cgd #define	FALSE	0
    190  1.1       cgd 
    191  1.1       cgd /*
    192  1.1       cgd  * Declaration of bitfields in various structs; if your C compiler
    193  1.1       cgd  * doesnt handle bitfields well, e.g., if it is unable to initialize
    194  1.1       cgd  * structs containing bitfields, then you might use
    195  1.1       cgd  *	#define Bitfield(x,n)	uchar x
    196  1.1       cgd  * since the bitfields used never have more than 7 bits. (Most have 1 bit.)
    197  1.1       cgd  */
    198  1.1       cgd #define	Bitfield(x,n)	unsigned x:n
    199  1.1       cgd 
    200  1.1       cgd #define	SIZE(x)	(int)(sizeof(x) / sizeof(x[0]))
    201  1.1       cgd 
    202  1.5  christos #endif /* CONFIG */
    203