src/config.h

Go to the documentation of this file.
00001 /* config.h */
00002 
00003 #ifndef CONFIG_H
00004 #define CONFIG_H
00005 
00006 #include "copyright.h"
00007 #include "autoconf.h"
00008 
00009 #define _GNU_SOURCE
00010 
00011 #include <stdio.h>
00012 #include <stdlib.h>
00013 #include <sys/fcntl.h>
00014 #include <sys/types.h>
00015 #include <ctype.h>
00016 #include <string.h>
00017 #include <sys/time.h>
00018 #include <time.h>
00019 #include <unistd.h>
00020 #include <errno.h>
00021 #include <fcntl.h>
00022 
00023 #ifdef STDC_HEADERS
00024 #include <stdarg.h>
00025 #else
00026 #include <varargs.h>
00027 #endif
00028 
00029 
00030 #include <sys/socket.h>
00031 #include <netinet/in.h>
00032 #include <netinet/tcp.h>
00033 
00034 #include "debug.h"
00035 
00036 typedef int     dbref;
00037 typedef int     FLAG;
00038 typedef int     POWER;
00039 typedef char    boolexp_type;
00040 typedef char    IBUF[16];
00041 
00042 #ifdef HAVE_SYS_RUSAGE_H
00043 #include <sys/rusage.h>
00044 #endif
00045 #if defined(HAVE_SETRLIMIT) || defined(HAVE_GETRUSAGE)
00046 #include <sys/resource.h>
00047 #endif
00048 
00049 #include <event.h>
00050 
00051 /* TEST_MALLOC: Defining this makes a malloc that keeps track of the number
00052  *              of blocks allocated.  Good for testing for Memory leaks.
00053  * ATR_NAME:    Define if you want name to be stored as an attribute on the
00054  *              object rather than in the object structure.
00055  */
00056 
00057 /* Compile time options */
00058 
00059 #define CONF_FILE "netmux.conf" /* Default config file */
00060 #define FILEDIR "files/"        /* Source for @cat */
00061 
00062 /* #define TEST_MALLOC *//* Keep track of block allocs */
00063 #define SIDE_EFFECT_FUNCTIONS   /* Those neat funcs that should be
00064                                  * commands */
00065 #define ENTERLEAVE_PARANOID     /* Enter/leave commands
00066                                    require opposite locks succeeding
00067                                    as well */
00068 #define PLAYER_NAME_LIMIT       22      /* Max length for player names */
00069 #define NUM_ENV_VARS            10      /* Number of env vars (%0 et al) */
00070 #define MAX_ARG                 100     /* max # args from command processor */
00071 #define MAX_GLOBAL_REGS         10      /* r() registers */
00072 
00073 #define HASH_FACTOR             16      /* How much hashing you want. */
00074 
00075 #define PLUSHELP_COMMAND        "+help" /* What you type to see the +help file */
00076 #define OUTPUT_BLOCK_SIZE       16384
00077 #define StringCopy              strcpy
00078 #define StringCopyTrunc         strncpy
00079 
00080 /* define DO_PARSE_WIZNEWS if wiznews.txt should be parsed like news.txt */
00081 /* #define DO_PARSE_WIZNEWS */
00082 
00083 #define CHANNEL_HISTORY
00084 #define CHANNEL_HISTORY_LEN     20      /* at max 20 last msgs */
00085 #define COMMAND_HISTORY_LEN     10      /* at max 10 last msgs */
00086 
00087 
00088 /* ---------------------------------------------------------------------------
00089  * Database R/W flags.
00090  */
00091 
00092 #define MANDFLAGS       (V_LINK|V_PARENT|V_XFLAGS|V_ZONE|V_POWERS|V_3FLAGS|V_QUOTED)
00093 
00094 #define OFLAGS1         (V_GDBM|V_ATRKEY)       /* GDBM has these */
00095 
00096 #define OFLAGS2         (V_ATRNAME|V_ATRMONEY)
00097 
00098 #define OUTPUT_VERSION  1       /* Version 1 */
00099 #define OUTPUT_FLAGS    (MANDFLAGS)
00100 
00101 #define UNLOAD_VERSION  1       /* verison for export */
00102 #define UNLOAD_OUTFLAGS (MANDFLAGS)     /* format for export */
00103 
00104 /* magic lock cookies */
00105 #define NOT_TOKEN       '!'
00106 #define AND_TOKEN       '&'
00107 #define OR_TOKEN        '|'
00108 #define LOOKUP_TOKEN    '*'
00109 #define NUMBER_TOKEN    '#'
00110 #define INDIR_TOKEN     '@'     /* One of these two should go. */
00111 #define CARRY_TOKEN     '+'     /* One of these two should go. */
00112 #define IS_TOKEN        '='
00113 #define OWNER_TOKEN     '$'
00114 
00115 /* matching attribute tokens */
00116 #define AMATCH_CMD      '$'
00117 #define AMATCH_LISTEN   '^'
00118 
00119 /* delimiters for various things */
00120 #define EXIT_DELIMITER  ';'
00121 #define ARG_DELIMITER   '='
00122 #define ARG_LIST_DELIM  ','
00123 
00124 /* These chars get replaced by the current item from a list in commands and
00125  * functions that do iterative replacement, such as @apply_marked, dolist,
00126  * the eval= operator for @search, and iter().
00127  */
00128 
00129 #define BOUND_VAR       "##"
00130 #define LISTPLACE_VAR   "#@"

/* amount of object endowment, based on cost */
#define OBJECT_ENDOWMENT(cost) (((cost)/mudconf.sacfactor) +mudconf.sacadjust)

/* !!! added for recycling, return value of object */
#define OBJECT_DEPOSIT(pennies) \
    (((pennies)-mudconf.sacadjust)*mudconf.sacfactor)


#define DEV_NULL "/dev/null"
00131 #define READ read
00132 #define WRITE write
00133 
00134 #ifdef BRAIN_DAMAGE             /* a kludge to get it to work on a mutant
00135                                  * DENIX system */
00136 #undef toupper
00137 #endif
00138 
00139 #ifdef TEST_MALLOC
00140 extern int malloc_count;
00141 
00142 #define XMALLOC(x,y) (fprintf(stderr,"Malloc: %s\n", (y)), malloc_count++, \
00143                     (char *)malloc((x)))
00144 #define XFREE(x,y) (fprintf(stderr, "Free: %s\n", (y)), \
00145                     ((x) ? malloc_count--, free((x)), (x)=NULL : (x)))
00146 #else
00147 #define XMALLOC(x,y) (char *)malloc((x))
00148 #define XFREE(x,y) (free((x)), (x) = NULL)
00149 #endif                          /* TEST_MALLOC */
00150 
00151 #ifdef ENTERLEAVE_PARANOID
00152 #define ENTER_REQUIRES_LEAVESUCC        /* Enter checks leaveloc of player's
00153                                            origin */
00154 #define LEAVE_REQUIRES_ENTERSUCC        /* Leave checks enterlock of player's
00155                                            origin */
00156 #endif
00157 
00158 #define EVAL_ALL_NEWS 1
00159 #include <sys/socket.h>
00160 #ifndef HAVE_SRANDOM
00161 #define random rand
00162 #define srandom srand
00163 #endif /* HAVE_SRANDOM */
00164 
00165 #ifndef HAVE_STRNLEN
00166 size_t strnlen(const char *s, size_t maxlen);
00167 #endif
00168 #ifndef HAVE_STRNDUP
00169 char *strndup(const char *s, size_t n);
00170 #endif
00171 #ifndef HAVE_POSIX_MEMALIGN
00172 int posix_memalign(void **memptr, size_t alignment, size_t size);
00173 #endif
00174 #ifndef HAVE_STRLCAT
00175 size_t strlcat(char *, const char *, size_t);
00176 #endif
00177 #ifndef HAVE_STRLCPY
00178 size_t strlcpy(char *, const char *, size_t);
00179 #endif
00180 
00181 #endif                          /* CONFIG_H */
00182 

Generated on Mon May 28 04:25:19 2007 for BattletechMUX by  doxygen 1.4.7