1 /* config2.h 2 */ 3 /* This software is copyrighted as detailed in the LICENSE file. */ 4 5 6 #ifdef HAS_GETPWENT 7 # include <pwd.h> 8 #endif 9 10 #ifdef I_UNISTD 11 # include <unistd.h> 12 #endif 13 14 #ifdef I_STDLIB 15 # include <stdlib.h> 16 #else 17 # ifndef USE_DEBUGGING_MALLOC 18 char* malloc(); 19 char* realloc(); 20 char* getenv(); 21 # endif 22 #endif 23 24 #ifdef USE_DEBUGGING_MALLOC 25 # include "malloc.h" 26 # define safemalloc malloc 27 # define saferealloc realloc 28 #endif 29 30 #ifdef I_STRING 31 # include <string.h> 32 #else 33 # include <strings.h> 34 #endif 35 36 #ifndef S_ISDIR 37 # define S_ISDIR(m) ( ((m) & S_IFMT) == S_IFDIR ) 38 #endif 39 #ifndef S_ISCHR 40 # define S_ISCHR(m) ( ((m) & S_IFMT) == S_IFCHR ) 41 #endif 42 #ifndef S_ISREG 43 # define S_ISREG(m) ( ((m) & S_IFMT) == S_IFREG ) 44 #endif 45 #ifndef isalnum 46 # define isalnum(c) (isalpha(c) || isdigit(c)) 47 #endif 48 49 #ifdef MSDOS 50 #include "msdos.h" 51 #endif 52 53 /* what to do with ansi prototypes -- '()' == ignore, 'x' == use */ 54 #ifndef _ 55 # if defined(__STDC__) || defined (MSDOS) 56 # define _(x) x 57 # ifndef CONST 58 # define CONST const 59 # endif 60 # else 61 # define _(x) () 62 # ifndef CONST 63 # define CONST 64 # endif 65 # endif 66 #endif 67 68 /* some handy defs */ 69 70 #define bool char 71 #define bool_int int 72 #define char_int int 73 #ifndef TRUE 74 #define TRUE 1 75 #endif 76 #ifndef FALSE 77 #define FALSE 0 78 #endif 79 80 #define Ctl(ch) (ch & 037) 81 82 #define strNE(s1,s2) (strcmp(s1,s2)) 83 #define strEQ(s1,s2) (!strcmp(s1,s2)) 84 #define strnNE(s1,s2,l) (strncmp(s1,s2,l)) 85 #define strnEQ(s1,s2,l) (!strncmp(s1,s2,l)) 86 87 #ifdef HAS_STRCASECMP 88 #define strcaseCMP(s1,s2) strcasecmp(s1,s2) 89 #define strcaseNE(s1,s2) (strcasecmp(s1,s2)) 90 #define strcaseEQ(s1,s2) (!strcasecmp(s1,s2)) 91 #define strncaseCMP(s1,s2,l) strncasecmp(s1,s2,l) 92 #define strncaseNE(s1,s2,l) (strncasecmp(s1,s2,l)) 93 #define strncaseEQ(s1,s2,l) (!strncasecmp(s1,s2,l)) 94 #else 95 #define strcaseCMP(s1,s2) trn_casecmp(s1,s2) 96 #define strcaseNE(s1,s2) (trn_casecmp(s1,s2)) 97 #define strcaseEQ(s1,s2) (!trn_casecmp(s1,s2)) 98 #define strncaseCMP(s1,s2,l) trn_ncasecmp(s1,s2,l) 99 #define strncaseNE(s1,s2,l) (trn_ncasecmp(s1,s2,l)) 100 #define strncaseEQ(s1,s2,l) (!trn_ncasecmp(s1,s2,l)) 101 #endif 102 103 /* some slight-of-hand for compatibility issues */ 104 105 #ifdef HAS_STRCHR 106 # ifndef index 107 # define index strchr 108 # endif 109 # ifndef rindex 110 # define rindex strrchr 111 # endif 112 #endif 113 #ifdef HAS_MEMCMP 114 # ifndef bcmp 115 # define bcmp(s,d,l) memcmp((s),(d),(l)) 116 # endif 117 #endif 118 #ifdef HAS_MEMCPY 119 # ifndef bcopy 120 # define bcopy(s,d,l) memcpy((d),(s),(l)) 121 # endif 122 #endif 123 #ifdef HAS_MEMSET 124 # ifndef bzero 125 # define bzero(s,l) memset((s),0,(l)) 126 # endif 127 #endif 128 129 #ifdef SUPPLEMENT_STRING_H 130 char* index(); 131 char* rindex(); 132 char* strcat(); 133 char* strcpy(); 134 #endif 135 136 #ifdef HAS_GETPWENT 137 # ifndef __STDC__ 138 struct passwd* getpwuid _((uid_t)); 139 struct passwd* getpwnam _((char*)); 140 # endif 141 #endif 142 143 #ifndef __STDC__ 144 char* getcwd(); 145 char* getlogin(); 146 int fseek(); 147 long atol(), ftell(); 148 extern int errno; 149 #endif 150 151 #ifndef FILE_REF 152 # define FILE_REF(s) (*(s) == '/' ? '/' : 0) 153 #endif 154 155 /* how to open binary format files */ 156 #ifndef FOPEN_RB 157 # define FOPEN_RB "r" 158 #endif 159 #ifndef FOPEN_WB 160 # define FOPEN_WB "w" 161 #endif 162