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