]>
Commit | Line | Data |
---|---|---|
03fb6eb0 A |
1 | /* |
2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights | |
7 | * Reserved. This file contains Original Code and/or Modifications of | |
8 | * Original Code as defined in and that are subject to the Apple Public | |
9 | * Source License Version 1.1 (the "License"). You may not use this file | |
10 | * except in compliance with the License. Please obtain a copy of the | |
11 | * License at http://www.apple.com/publicsource and read it before using | |
12 | * this file. | |
13 | * | |
14 | * The Original Code and all software distributed under the License are | |
15 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
18 | * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the | |
19 | * License for the specific language governing rights and limitations | |
20 | * under the License. | |
21 | * | |
22 | * @APPLE_LICENSE_HEADER_END@ | |
23 | */ | |
24 | /* portability.h - include or define things that aren't present on all systems | |
25 | * vixie@decwrl 26dec92 [new] | |
26 | * | |
27 | * $Id: portability.h,v 1.2 1999/10/14 21:56:45 wsanchez Exp $ | |
28 | */ | |
29 | ||
30 | /* | |
31 | * ++Copyright++ | |
32 | * - | |
33 | * Copyright (c) | |
34 | * The Regents of the University of California. All rights reserved. | |
35 | * | |
36 | * Redistribution and use in source and binary forms, with or without | |
37 | * modification, are permitted provided that the following conditions | |
38 | * are met: | |
39 | * 1. Redistributions of source code must retain the above copyright | |
40 | * notice, this list of conditions and the following disclaimer. | |
41 | * 2. Redistributions in binary form must reproduce the above copyright | |
42 | * notice, this list of conditions and the following disclaimer in the | |
43 | * documentation and/or other materials provided with the distribution. | |
44 | * 3. All advertising materials mentioning features or use of this software | |
45 | * must display the following acknowledgement: | |
46 | * This product includes software developed by the University of | |
47 | * California, Berkeley and its contributors. | |
48 | * 4. Neither the name of the University nor the names of its contributors | |
49 | * may be used to endorse or promote products derived from this software | |
50 | * without specific prior written permission. | |
51 | * | |
52 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
53 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
54 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
55 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
58 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
59 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
60 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
61 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
62 | * SUCH DAMAGE. | |
63 | * - | |
64 | * Portions Copyright (c) 1993 by Digital Equipment Corporation. | |
65 | * | |
66 | * Permission to use, copy, modify, and distribute this software for any | |
67 | * purpose with or without fee is hereby granted, provided that the above | |
68 | * copyright notice and this permission notice appear in all copies, and that | |
69 | * the name of Digital Equipment Corporation not be used in advertising or | |
70 | * publicity pertaining to distribution of the document or software without | |
71 | * specific, written prior permission. | |
72 | * | |
73 | * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL | |
74 | * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES | |
75 | * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT | |
76 | * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | |
77 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR | |
78 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | |
79 | * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
80 | * SOFTWARE. | |
81 | * - | |
82 | * --Copyright-- | |
83 | */ | |
84 | ||
85 | /* XXX: this file has become a hopeless morass, and will be redone someday. */ | |
86 | ||
87 | #include <string.h> | |
88 | #include <sys/types.h> | |
89 | #include <sys/param.h> | |
90 | #ifndef TIME_H_INCLUDED | |
91 | # include <sys/time.h> | |
92 | # define TIME_H_INCLUDED | |
93 | #endif | |
94 | ||
95 | #ifdef ISC | |
96 | # ifndef _POSIX_SOURCE | |
97 | # define _POSIX_SOURCE | |
98 | # endif | |
99 | # define SYSV | |
100 | # define SVR3 | |
101 | # define _SYSV3 | |
102 | # define NEED_STRTOUL | |
103 | # define NEED_FTRUNCATE | |
104 | # define USE_POSIX | |
105 | # include <sys/bsdtypes.h> | |
106 | # include <sys/sioctl.h> | |
107 | # include <sys/stream.h> | |
108 | # include <net/errno.h> | |
109 | #endif | |
110 | ||
111 | #if defined(__convex__) | |
112 | # if !defined(_POSIX_SOURCE) | |
113 | # define _POSIX_SOURCE | |
114 | # endif | |
115 | # define USE_UTIME | |
116 | # define NEED_PUTENV | |
117 | #endif | |
118 | ||
119 | #if defined(_CRAY) | |
120 | # if !defined(_POSIX_SOURCE) | |
121 | # define _POSIX_SOURCE | |
122 | # endif | |
123 | # define writev(a,b,c) __writev(a,b,c) | |
124 | # define setitimer(a,b,c) __setitimer(a,b,c) | |
125 | #endif | |
126 | ||
127 | /* This is defined in the Makefile for ISC compiles. */ | |
128 | #if defined(ISC) | |
129 | # define ftruncate(a,b) __ftruncate(a,b) | |
130 | # define USE_MEMCPY | |
131 | # define USE_UTIME | |
132 | # define HAVE_FCHMOD 0 | |
133 | #endif | |
134 | ||
135 | /* SCO UNIX defines only this unique symbol, apparently. */ | |
136 | #if defined(M_UNIX) | |
137 | /* XXX - why is this POSIX_SOURCE instead of _POSIX_SOURCE? */ | |
138 | # undef POSIX_SOURCE | |
139 | # define POSIX_SIGNALS | |
140 | # define HAVE_FCHMOD 0 | |
141 | # define writev(a,b,c) __writev(a,b,c) | |
142 | # define ftruncate(a,b) __ftruncate(a,b) | |
143 | #endif | |
144 | ||
145 | #if defined(__APPLE__) && BSD < 199506 | |
146 | # define NEED_PUTENV | |
147 | # define NEED_SETENV | |
148 | #endif | |
149 | ||
150 | #if defined(__sgi) | |
151 | # define BSD 43 | |
152 | # define vfork fork | |
153 | #endif | |
154 | ||
155 | #if defined(SUNOS4) | |
156 | # define BSD 43 | |
157 | #endif | |
158 | ||
159 | #if defined(_AUX_SOURCE) | |
160 | # define vfork fork | |
161 | # define NEED_STRERROR | |
162 | # define NEED_STRTOUL | |
163 | # define SIG_FN void | |
164 | # define USE_MEMCPY | |
165 | #endif | |
166 | ||
167 | ||
168 | #if defined(SVR4) && !defined(SYSV) | |
169 | # define SYSV | |
170 | #endif | |
171 | ||
172 | #if defined(_POSIX_SOURCE) || defined(__sgi) || defined(__ultrix) || \ | |
173 | defined(__hpux) || (defined(BSD) && (BSD >= 199103)) || \ | |
174 | (defined(sun) && defined(SYSV)) | |
175 | # define USE_POSIX | |
176 | #endif | |
177 | ||
178 | #if defined(__ultrix) && !defined(BSD) | |
179 | # define BSD 42 | |
180 | #endif | |
181 | ||
182 | #if defined(host_mips) && defined(SYSTYPE_BSD43) | |
183 | # define RISCOS_BSD | |
184 | #endif | |
185 | ||
186 | #if defined(SYSV) || defined(__ultrix) || defined(__osf__) \ | |
187 | || (defined(BSD) && BSD >= 199306) || defined(linux) | |
188 | # define USE_UTIME | |
189 | # define HAVE_SETVBUF | |
190 | #endif | |
191 | ||
192 | #if defined(SYSV) && !defined(SVR4) | |
193 | # define vfork fork | |
194 | #endif | |
195 | ||
196 | #if defined(sun) || defined(SVR4) | |
197 | # define NETREAD_BROKEN | |
198 | #endif | |
199 | ||
200 | #if defined(BSD) && BSD >= 199006 && !defined(i386) && !defined(RISCOS_BSD) | |
201 | # define HAVE_DAEMON | |
202 | #endif | |
203 | ||
204 | #if !defined(BSD) || (BSD <= 199006) | |
205 | # if !defined(__APPLE__) | |
206 | # define NEED_INETADDR | |
207 | # endif | |
208 | # define NEED_INETATON | |
209 | #endif | |
210 | ||
211 | #if defined(__hpux) | |
212 | # if defined(__STDC__) | |
213 | # define select(a,b,c,d,e) select(a, (int *)b, (int *)c, (int *)d, e) | |
214 | # define ctime(x) ctime((const time_t *)x) | |
215 | # endif /*__STDC__*/ | |
216 | # if !defined(SYSV) | |
217 | # define USE_UTIME | |
218 | # define setlinebuf(x) setvbuf(x, NULL, _IOLBF, BUFSIZ) | |
219 | # if !defined(SIGWINCH) /*pre 9.0*/ | |
220 | # define SIGWINCH SIGWINDOW | |
221 | # endif | |
222 | # endif /*SYSV*/ | |
223 | /* XXX: better autodetection of the need for "struct linger" would be nice */ | |
224 | # if 0 | |
225 | struct linger { | |
226 | int l_onoff; /* option on/off */ | |
227 | int l_linger; /* linger time */ | |
228 | }; | |
229 | # endif | |
230 | #endif /*__hpux*/ | |
231 | ||
232 | #if defined(_SEQUENT_) | |
233 | # include <netinet/in_systm.h> | |
234 | # define USE_UTIME | |
235 | # define USE_POSIX | |
236 | # define NEED_GETTIMEOFDAY | |
237 | # define _TIMEZONE timezoneBSD | |
238 | struct timezoneBSD { | |
239 | int tz_minuteswest; | |
240 | int tz_dsttime; | |
241 | }; | |
242 | #endif | |
243 | ||
244 | #ifndef __P | |
245 | # if defined(__STDC__) || defined(__GNUC__) | |
246 | # define __P(x) x | |
247 | # else | |
248 | # define __P(x) () | |
249 | # endif | |
250 | #endif | |
251 | ||
252 | #ifndef _TIMEZONE | |
253 | # define _TIMEZONE timezone | |
254 | #endif | |
255 | ||
256 | #if defined(USE_POSIX) | |
257 | # include <stdlib.h> | |
258 | # include <unistd.h> | |
259 | # include <limits.h> | |
260 | ||
261 | #else | |
262 | ||
263 | # define NEED_STRTOUL | |
264 | ||
265 | # define STDIN_FILENO 0 | |
266 | # define STDOUT_FILENO 1 | |
267 | # define STDERR_FILENO 2 | |
268 | # ifndef __APPLE__ | |
269 | extern char *getenv __P((char *)); | |
270 | # else | |
271 | extern char *getenv __P((const char *)); | |
272 | # endif | |
273 | extern int errno; | |
274 | ||
275 | # if !defined(DMALLOC) && !defined(__APPLE__) | |
276 | extern char *malloc(), *realloc(), *calloc(); | |
277 | # if defined(sun) | |
278 | extern int free(); | |
279 | # else | |
280 | extern void free(); | |
281 | # endif | |
282 | # endif | |
283 | ||
284 | extern int getdtablesize __P((void)); | |
285 | # ifdef SHORT_FNAMES | |
286 | extern long pathconf __P((const char *path, int name)); | |
287 | # endif | |
288 | ||
289 | #endif /*USE_POSIX*/ | |
290 | ||
291 | #ifndef UINT_MAX | |
292 | # ifdef __STDC__ | |
293 | # define UINT_MAX 4294967295u /* max value of an "u_int" */ | |
294 | # else | |
295 | # define UINT_MAX ((unsigned)4294967295) /* max value of an "u_int" */ | |
296 | # endif | |
297 | # define ULONG_MAX UINT_MAX /* max decimal value of a "u_long" */ | |
298 | #endif | |
299 | ||
300 | #ifndef INT_MAX | |
301 | # define INT_MAX 2147483647 /* max decimal value of an "int" */ | |
302 | #endif | |
303 | ||
304 | #ifndef RAND_MAX | |
305 | # define RAND_MAX 0x7fffffff | |
306 | #endif | |
307 | ||
308 | #ifndef IN_LOOPBACKNET | |
309 | # define IN_LOOPBACKNET 127 | |
310 | #endif | |
311 | ||
312 | #ifndef INADDR_NONE | |
313 | # define INADDR_NONE 0xffffffff | |
314 | #endif | |
315 | ||
316 | #if defined(apollo) | |
317 | /* Defined in /usr/include/netinet/in.h but doesn't work */ | |
318 | #undef IP_OPTIONS | |
319 | #endif | |
320 | ||
321 | #if !defined(__STDC__) && !defined(const) | |
322 | # define const /*constant*/ | |
323 | #endif | |
324 | ||
325 | #if !defined(__convex__) && (!defined(BSD) || (BSD < 199103)) | |
326 | int strcasecmp __P((const char *, const char *)); | |
327 | #endif | |
328 | ||
329 | /* is USE_POSIX the right thing to use here? */ | |
330 | #if (!defined(BSD) || (BSD <= 43)) && \ | |
331 | !defined(NeXT) && \ | |
332 | !defined(__convex__) && \ | |
333 | !defined(USE_POSIX) | |
334 | # if !defined(NCR) | |
335 | extern void syslog(); | |
336 | # endif | |
337 | extern char *ctime __P((const time_t *clock)); | |
338 | extern int close(), setitimer(), recv(), sendto(), sigsetmask(), | |
339 | atoi(), getpid(), fork(), read(), ioctl(), | |
340 | setsockopt(), socket(), bind(); | |
341 | #endif | |
342 | ||
343 | #if !defined(bcopy) /* some machines have their own macros for this */ | |
344 | # if defined(USE_POSIX) || \ | |
345 | (defined(__STDC__) && !defined(sun) && !defined(sequent)) | |
346 | /* use ANSI C3.159-1989 (``ANSI C'') functions if possible; | |
347 | * ideally we would change the code to use them and then | |
348 | * define them in terms of bcopy et al if !defined(__STDC__) | |
349 | * but that's more work. | |
350 | */ | |
351 | #if defined(USE_MEMCPY) | |
352 | # define bcopy(a,b,c) memcpy(b,a,c) | |
353 | #else | |
354 | # define bcopy(a,b,c) memmove(b,a,c) | |
355 | #endif | |
356 | # define bzero(a,b) memset(a,0,b) | |
357 | # define bcmp(a,b,c) memcmp(a,b,c) | |
358 | # else | |
359 | extern void bcopy(); | |
360 | extern void bzero(); | |
361 | extern int bcmp(); | |
362 | # endif /* BSD */ | |
363 | #endif /* bcopy */ | |
364 | ||
365 | #if (!defined(BSD) || (BSD < 43) || defined(RISCOS_BSD)) \ | |
366 | && !defined(USE_POSIX) && !defined(apollo) && !defined(sequent) \ | |
367 | && !defined(M_UNIX) | |
368 | # define NEED_STRERROR | |
369 | #if !defined(ultrix) && !defined(NCR) | |
370 | # define NEED_PUTENV | |
371 | #endif | |
372 | #endif | |
373 | ||
374 | #if defined(SUNOS4) | |
375 | # define NEED_STRERROR | |
376 | # if defined(sun386) | |
377 | # define pid_t int | |
378 | # define NEED_STRCASECMP | |
379 | # endif | |
380 | #endif | |
381 | ||
382 | #if (!defined(BSD) || (BSD < 43)) | |
383 | # define NEED_MKSTEMP | |
384 | # if !defined(__ultrix) && !defined(apollo) | |
385 | # define NEED_STRCASECMP | |
386 | # define NEED_MKTEMP | |
387 | # if !defined(SVR4) | |
388 | # define NEED_STRPBRK | |
389 | # endif | |
390 | # endif | |
391 | #endif | |
392 | ||
393 | #if defined(USE_POSIX) | |
394 | # define POSIX_SIGNALS | |
395 | #endif | |
396 | ||
397 | /* | |
398 | * Attempt to configure for type of function returned by signal-catching | |
399 | * functions (which signal and sigvec.sv_handler take a pointer to). | |
400 | * This can guess for BSD; otherwise, define SIG_FN externally. | |
401 | */ | |
402 | #ifndef SIG_FN | |
403 | # ifdef BSD | |
404 | # if (BSD >= 199006) || defined(__APPLE__) || defined(__osf__) || defined(sun) \ | |
405 | || defined(__ultrix) || defined(apollo) || defined(POSIX_SIGNALS) | |
406 | # define SIG_FN void /* signal-catching functions return void */ | |
407 | # else | |
408 | # define SIG_FN int /* signal-catching functions return int */ | |
409 | # endif | |
410 | # else /*BSD*/ | |
411 | # define SIG_FN void /* signal-catching functions return void */ | |
412 | # endif /*BSD*/ | |
413 | #endif | |
414 | ||
415 | #if !defined(ntohl) && !defined(htonl) && defined(BSD) && (BSD <= 43) | |
416 | /* if these aren't null macros in netinet/in.h, extern them here. */ | |
417 | extern u_short htons(), ntohs(); | |
418 | extern u_long htonl(), ntohl(); | |
419 | #endif | |
420 | ||
421 | #if defined(USE_POSIX) && !defined(sun) && !defined(__sgi) \ | |
422 | && !defined(__convex__) && !defined(__ultrix) && !defined(_AUX_SOURCE) | |
423 | # define PORT_NONBLOCK O_NONBLOCK | |
424 | # define PORT_WOULDBLK EAGAIN | |
425 | #else | |
426 | # define PORT_NONBLOCK O_NDELAY | |
427 | # define PORT_WOULDBLK EWOULDBLOCK | |
428 | #endif | |
429 | ||
430 | #if defined(USE_POSIX) | |
431 | # define USE_SETSID | |
432 | #endif | |
433 | ||
434 | #if defined(USE_POSIX) || !defined(SYSV) | |
435 | #define USE_WAITPID | |
436 | #endif | |
437 | ||
438 | #if !defined(USE_POSIX) | |
439 | #define waitpid(x,y,z) (wait3(y,z,(struct rusage *)NULL)) | |
440 | #endif | |
441 | ||
442 | #if defined(__APPLE__) || defined(_AIX) || defined(sun386) | |
443 | # undef WIFEXITED | |
444 | # undef WEXITSTATUS | |
445 | # undef WIFSIGNALED | |
446 | # undef WTERMSIG | |
447 | #endif /* NeXT */ | |
448 | ||
449 | #if defined(sequent) | |
450 | #define WEXITSTATUS(x) ((x).w_retcode) | |
451 | #define WTERMSIG(x) ((x).w_termsig) | |
452 | #endif /* sequent */ | |
453 | ||
454 | #if !defined(WIFEXITED) | |
455 | # define WIFEXITED(x) (!(x & 0177)) | |
456 | #endif | |
457 | #if !defined(WEXITSTATUS) | |
458 | # define WEXITSTATUS(x) (x >> 8) | |
459 | #endif | |
460 | #if !defined(WIFSIGNALED) | |
461 | # define WIFSIGNALED(x) ((x & 0177) && ((x & 0377) != 0177)) | |
462 | #endif | |
463 | #if !defined(WTERMSIG) | |
464 | # define WTERMSIG(x) (x & 0177) | |
465 | #endif | |
466 | ||
467 | #ifndef S_ISDIR | |
468 | # ifndef S_IFMT | |
469 | # define S_IFMT 0170000 | |
470 | # endif | |
471 | # ifndef S_IFDIR | |
472 | # define S_IFDIR 0040000 | |
473 | # endif | |
474 | # define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR) | |
475 | #endif | |
476 | ||
477 | #ifndef S_ISREG | |
478 | # ifndef S_IFMT | |
479 | # define S_IFMT 0170000 | |
480 | # endif | |
481 | # ifndef S_IFREG | |
482 | # define S_IFREG 0100000 | |
483 | # endif | |
484 | # define S_ISREG(m) ((m & S_IFMT) == S_IFREG) | |
485 | #endif | |
486 | ||
487 | #ifndef S_ISFIFO | |
488 | # ifndef S_IFMT | |
489 | # define S_IFMT 0170000 | |
490 | # endif | |
491 | # ifndef S_IFIFO | |
492 | # define S_IFIFO 0010000 | |
493 | # endif | |
494 | # define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO) | |
495 | #endif | |
496 | ||
497 | #if defined(NEED_STRTOUL) && \ | |
498 | (defined(__ultrix) || defined(__osf__) || defined(NeXT)) | |
499 | # undef NEED_STRTOUL | |
500 | #endif | |
501 | ||
502 | #if defined(__ultrix) || defined(__osf__) | |
503 | # define MAYBE_HESIOD | |
504 | #endif | |
505 | ||
506 | #ifndef FD_SET | |
507 | #define NFDBITS 32 | |
508 | #define FD_SETSIZE 32 | |
509 | #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) | |
510 | #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) | |
511 | #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) | |
512 | #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) | |
513 | #endif | |
514 | ||
515 | #ifndef MIN | |
516 | # define MIN(x, y) ((x > y) ?y :x) | |
517 | #endif | |
518 | #ifndef MAX | |
519 | # define MAX(x, y) ((x > y) ?x :y) | |
520 | #endif | |
521 | ||
522 | #if !defined(PATH_MAX) | |
523 | # if defined(_POSIX_PATH_MAX) | |
524 | # define PATH_MAX _POSIX_PATH_MAX | |
525 | # else | |
526 | # if defined(MAXPATHLEN) | |
527 | # define PATH_MAX MAXPATHLEN | |
528 | # endif | |
529 | # endif | |
530 | #endif | |
531 | ||
532 | #if defined(BSD) || defined(__osf__) || defined(__convex__) | |
533 | # define HAVE_GETRUSAGE | |
534 | #endif | |
535 | ||
536 | /* May be set in the Makefile. */ | |
537 | #if defined(HAVE_GETRUSAGE) | |
538 | # include <sys/resource.h> | |
539 | #endif | |
540 | ||
541 | /* | |
542 | * Because Convex has true library function feof() which is | |
543 | * patently wrong (it test bit _IOREAD) we need feof() as | |
544 | * a macro. | |
545 | */ | |
546 | #if defined(__convex__) && !defined(feof) | |
547 | # define feof(p) ((p)->_flag&_IOEOF) | |
548 | #endif | |
549 | ||
550 | #if defined(M_UNIX) || defined(linux) | |
551 | # define SPURIOUS_ECONNREFUSED | |
552 | #endif | |
553 | ||
554 | /* | |
555 | * Assume that a system has fchmod() unless something above says otherwise. | |
556 | */ | |
557 | #if !defined(HAVE_FCHMOD) | |
558 | # define HAVE_FCHMOD 1 | |
559 | #endif | |
560 | ||
561 | /* | |
562 | * Prototype the functions we'll be supplying. | |
563 | */ | |
564 | #ifdef NEED_PUTENV | |
565 | extern int putenv __P((char *)); | |
566 | #endif | |
567 | ||
568 | #ifdef NEED_GETTIMEOFDAY | |
569 | extern int gettimeofday __P((struct timeval *, struct _TIMEZONE *)); | |
570 | #endif |