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