Commit | Line | Data |
---|---|---|
1bd76676 GW |
1 | #ifndef PRIVATE_H |
2 | ||
3 | #define PRIVATE_H | |
4 | ||
5 | /* | |
6 | ** This header is for use ONLY with the time conversion code. | |
7 | ** There is no guarantee that it will remain unchanged, | |
8 | ** or that it will remain at all. | |
9 | ** Do NOT copy it to any system include directory. | |
10 | ** Thank you! | |
11 | */ | |
12 | ||
13 | /* | |
14 | ** ID | |
15 | */ | |
16 | ||
17 | #ifndef lint | |
18 | #ifndef NOID | |
6b599c2a | 19 | static char privatehid[] = "@(#)private.h 7.5"; |
1bd76676 GW |
20 | #endif /* !defined NOID */ |
21 | #endif /* !defined lint */ | |
22 | ||
23 | /* | |
24 | ** const | |
25 | */ | |
26 | ||
27 | #ifndef const | |
28 | #ifndef __STDC__ | |
29 | #define const | |
30 | #endif /* !defined __STDC__ */ | |
31 | #endif /* !defined const */ | |
32 | ||
33 | /* | |
34 | ** void | |
35 | */ | |
36 | ||
37 | #ifndef void | |
38 | #ifndef __STDC__ | |
39 | #ifndef vax | |
40 | #ifndef sun | |
41 | #define void char | |
42 | #endif /* !defined sun */ | |
43 | #endif /* !defined vax */ | |
44 | #endif /* !defined __STDC__ */ | |
45 | #endif /* !defined void */ | |
46 | ||
47 | /* | |
48 | ** P((args)) | |
49 | */ | |
50 | ||
51 | #ifndef P | |
52 | #ifdef __STDC__ | |
53 | #define P(x) x | |
6b599c2a GW |
54 | #endif /* defined __STDC__ */ |
55 | #ifndef __STDC__ | |
1bd76676 GW |
56 | #define ASTERISK * |
57 | #define P(x) ( /ASTERISK x ASTERISK/ ) | |
58 | #endif /* !defined __STDC__ */ | |
59 | #endif /* !defined P */ | |
60 | ||
61 | /* | |
62 | ** genericptr_t | |
63 | */ | |
64 | ||
65 | #ifdef __STDC__ | |
66 | typedef void * genericptr_t; | |
6b599c2a GW |
67 | #endif /* defined __STDC__ */ |
68 | #ifndef __STDC__ | |
1bd76676 GW |
69 | typedef char * genericptr_t; |
70 | #endif /* !defined __STDC__ */ | |
71 | ||
72 | #include "sys/types.h" /* for time_t */ | |
73 | #include "stdio.h" | |
74 | #include "ctype.h" | |
75 | #include "errno.h" | |
76 | #include "string.h" | |
77 | #include "limits.h" /* for CHAR_BIT */ | |
78 | #ifndef _TIME_ | |
79 | #include "time.h" | |
80 | #endif /* !defined _TIME_ */ | |
81 | ||
82 | #ifndef remove | |
83 | extern int unlink P((const char * filename)); | |
84 | #define remove unlink | |
85 | #endif /* !defined remove */ | |
86 | ||
87 | #ifndef FILENAME_MAX | |
88 | ||
89 | #ifndef MAXPATHLEN | |
90 | #ifdef unix | |
91 | #include "sys/param.h" | |
92 | #endif /* defined unix */ | |
93 | #endif /* !defined MAXPATHLEN */ | |
94 | ||
95 | #ifdef MAXPATHLEN | |
96 | #define FILENAME_MAX MAXPATHLEN | |
6b599c2a GW |
97 | #endif /* defined MAXPATHLEN */ |
98 | #ifndef MAXPATHLEN | |
1bd76676 GW |
99 | #define FILENAME_MAX 1024 /* Pure guesswork */ |
100 | #endif /* !defined MAXPATHLEN */ | |
101 | ||
102 | #endif /* !defined FILENAME_MAX */ | |
103 | ||
104 | #ifndef EXIT_SUCCESS | |
105 | #define EXIT_SUCCESS 0 | |
106 | #endif /* !defined EXIT_SUCCESS */ | |
107 | ||
108 | #ifndef EXIT_FAILURE | |
109 | #define EXIT_FAILURE 1 | |
110 | #endif /* !defined EXIT_FAILURE */ | |
111 | ||
112 | #ifdef __STDC__ | |
113 | ||
114 | #define alloc_size_t size_t | |
115 | #define qsort_size_t size_t | |
116 | #define fwrite_size_t size_t | |
117 | ||
6b599c2a GW |
118 | #endif /* defined __STDC__ */ |
119 | #ifndef __STDC__ | |
1bd76676 GW |
120 | |
121 | #ifndef alloc_size_t | |
122 | #define alloc_size_t unsigned | |
123 | #endif /* !defined alloc_size_t */ | |
124 | ||
125 | #ifndef qsort_size_t | |
126 | #ifdef USG | |
127 | #define qsort_size_t unsigned | |
6b599c2a GW |
128 | #endif /* defined USG */ |
129 | #ifndef USG | |
1bd76676 GW |
130 | #define qsort_size_t int |
131 | #endif /* !defined USG */ | |
132 | #endif /* !defined qsort_size_t */ | |
133 | ||
134 | #ifndef fwrite_size_t | |
135 | #define fwrite_size_t int | |
136 | #endif /* !defined fwrite_size_t */ | |
137 | ||
138 | #ifndef USG | |
139 | extern char * sprintf P((char * buf, const char * format, ...)); | |
140 | #endif /* !defined USG */ | |
141 | ||
142 | #endif /* !defined __STDC__ */ | |
143 | ||
144 | /* | |
145 | ** Ensure that these are declared--redundantly declaring them shouldn't hurt. | |
146 | */ | |
147 | ||
148 | extern char * getenv P((const char * name)); | |
149 | extern genericptr_t malloc P((alloc_size_t size)); | |
150 | extern genericptr_t calloc P((alloc_size_t nelem, alloc_size_t elsize)); | |
151 | extern genericptr_t realloc P((genericptr_t oldptr, alloc_size_t newsize)); | |
152 | ||
153 | #ifdef USG | |
154 | extern void exit P((int s)); | |
155 | extern void qsort P((genericptr_t base, qsort_size_t nelem, | |
156 | qsort_size_t elsize, int (*comp)())); | |
157 | extern void perror P((const char * string)); | |
158 | extern void free P((char * buf)); | |
159 | #endif /* defined USG */ | |
160 | ||
161 | #ifndef TRUE | |
162 | #define TRUE 1 | |
163 | #endif /* !defined TRUE */ | |
164 | ||
165 | #ifndef FALSE | |
166 | #define FALSE 0 | |
167 | #endif /* !defined FALSE */ | |
168 | ||
169 | #ifndef INT_STRLEN_MAXIMUM | |
170 | /* | |
171 | ** 302 / 1000 is log10(2.0) rounded up. | |
172 | ** Subtract one for the sign bit; | |
173 | ** add one for integer division truncation; | |
174 | ** add one more for a minus sign. | |
175 | */ | |
176 | #define INT_STRLEN_MAXIMUM(type) \ | |
177 | ((sizeof(type) * CHAR_BIT - 1) * 302 / 1000 + 2) | |
178 | #endif /* !defined INT_STRLEN_MAXIMUM */ | |
179 | ||
180 | /* | |
181 | ** UNIX is a registered trademark of AT&T. | |
182 | ** VAX is a trademark of Digital Equipment Corporation. | |
183 | */ | |
184 | ||
185 | #endif /* !defined PRIVATE_H */ |