Home | History | Annotate | Line # | Download | only in hack
config.h revision 1.6
      1  1.6       cgd /*	$NetBSD: config.h,v 1.6 2001/01/16 02:50:28 cgd Exp $	*/
      2  1.5  christos 
      3  1.2   mycroft /*
      4  1.2   mycroft  * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985.
      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.6       cgd #endif /* BSD */
     71  1.6       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.6       cgd #else /* QUEST */
     81  1.1       cgd #define HACKDIR	_PATH_HACK
     82  1.6       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.6       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.5  christos  *
    110  1.5  christos  * Use short chars anyway to avoid warnings.
    111  1.1       cgd  */
    112  1.5  christos #if 1
    113  1.4   thorpej typedef	short int	schar;
    114  1.4   thorpej #else
    115  1.4   thorpej typedef	char		schar;
    116  1.4   thorpej #endif
    117  1.1       cgd 
    118  1.1       cgd /*
    119  1.1       cgd  * small unsigned integers (8 bits suffice - but 7 bits do not)
    120  1.1       cgd  * - these are usually object types; be careful with inequalities! -
    121  1.1       cgd  *	typedef	unsigned char	uchar;
    122  1.1       cgd  * will be satisfactory if you have an "unsigned char" type; otherwise use
    123  1.1       cgd  *	typedef unsigned short int uchar;
    124  1.1       cgd  */
    125  1.1       cgd typedef	unsigned char	uchar;
    126  1.1       cgd 
    127  1.1       cgd /*
    128  1.1       cgd  * small integers in the range 0 - 127, usually coordinates
    129  1.1       cgd  * although they are nonnegative they must not be declared unsigned
    130  1.1       cgd  * since otherwise comparisons with signed quantities are done incorrectly
    131  1.1       cgd  */
    132  1.1       cgd typedef schar	xchar;
    133  1.1       cgd typedef	xchar	boolean;		/* 0 or 1 */
    134  1.1       cgd #define	TRUE	1
    135  1.1       cgd #define	FALSE	0
    136  1.1       cgd 
    137  1.1       cgd /*
    138  1.1       cgd  * Declaration of bitfields in various structs; if your C compiler
    139  1.1       cgd  * doesnt handle bitfields well, e.g., if it is unable to initialize
    140  1.1       cgd  * structs containing bitfields, then you might use
    141  1.1       cgd  *	#define Bitfield(x,n)	uchar x
    142  1.1       cgd  * since the bitfields used never have more than 7 bits. (Most have 1 bit.)
    143  1.1       cgd  */
    144  1.1       cgd #define	Bitfield(x,n)	unsigned x:n
    145  1.1       cgd 
    146  1.1       cgd #define	SIZE(x)	(int)(sizeof(x) / sizeof(x[0]))
    147  1.1       cgd 
    148  1.5  christos #endif /* CONFIG */
    149