FBSD: Remove support for 8.x and 9.x
[openafs.git] / src / afsweb / apache_includes / conf.h
1 /* ====================================================================
2  * Copyright (c) 1995-1997 The Apache Group.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in
13  *    the documentation and/or other materials provided with the
14  *    distribution.
15  *
16  * 3. All advertising materials mentioning features or use of this
17  *    software must display the following acknowledgment:
18  *    "This product includes software developed by the Apache Group
19  *    for use in the Apache HTTP server project (http://www.apache.org/)."
20  *
21  * 4. The names "Apache Server" and "Apache Group" must not be used to
22  *    endorse or promote products derived from this software without
23  *    prior written permission.
24  *
25  * 5. Redistributions of any form whatsoever must retain the following
26  *    acknowledgment:
27  *    "This product includes software developed by the Apache Group
28  *    for use in the Apache HTTP server project (http://www.apache.org/)."
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
31  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
34  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
36  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
37  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
41  * OF THE POSSIBILITY OF SUCH DAMAGE.
42  * ====================================================================
43  *
44  * This software consists of voluntary contributions made by many
45  * individuals on behalf of the Apache Group and was originally based
46  * on public domain software written at the National Center for
47  * Supercomputing Applications, University of Illinois, Urbana-Champaign.
48  * For more information on the Apache Group and the Apache HTTP server
49  * project, please see <http://www.apache.org/>.
50  *
51  */
52
53 /*
54  * conf.h: system-dependant #defines and includes...
55  * See PORTING for a listing of what they mean
56  */
57
58 #if !defined(QNX) && !defined(MPE)
59 #include <sys/param.h>
60 #endif
61
62 /* Define one of these according to your system. */
63 #if defined(MPE)
64 #include <sys/times.h>
65 #define JMP_BUF sigjmp_buf
66 #define NO_SETSID
67 #define NO_KILLPG
68 #define NO_WRITEV
69 #define NEED_INITGROUPS
70 #define NEED_STRCASECMP
71 #define NEED_STRDUP
72 #define NEED_STRNCASECMP
73 extern void GETPRIVMODE();
74 extern void GETUSERMODE();
75 extern char *inet_ntoa();
76 #define NO_SLACK
77
78 #elif defined(SUNOS4)
79 #define HAVE_GMTOFF
80 #define HAVE_SYS_RESOURCE_H
81 #undef NO_KILLPG
82 #undef NO_SETSID
83 char *crypt(const char *pw, const char *salt);
84 char *mktemp(char *template);
85 #define JMP_BUF sigjmp_buf
86 #define HAVE_MMAP
87 #include <sys/time.h>
88 #define NEED_STRERROR
89 typedef int rlim_t;
90 #ifndef HAVE_MEMMOVE
91 #define memmove(a,b,c) memcpy(a, b, c)
92 #endif
93 #define NO_LINGCLOSE
94 #define USE_FLOCK_SERIALIZED_ACCEPT
95
96 #elif defined(SOLARIS2)
97 #undef HAVE_GMTOFF
98 #define NO_KILLPG
99 #undef NO_SETSID
100 #define HAVE_SYS_RESOURCE_H
101 #define JMP_BUF sigjmp_buf
102 #define USE_FCNTL_SERIALIZED_ACCEPT
103 #define HAVE_MMAP
104 #define HAVE_CRYPT_H
105 int gethostname(char *name, int namelen);
106
107 #elif defined(IRIX)
108 #undef HAVE_GMTOFF
109 /* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
110  * there's some weird conflict with non-BSD signals */
111 #define NO_KILLPG
112 #undef NO_SETSID
113 #define JMP_BUF sigjmp_buf
114 #define USE_FCNTL_SERIALIZED_ACCEPT
115 #define HAVE_SHMGET
116 #define HAVE_CRYPT_H
117 #define NO_LONG_DOUBLE
118 #define HAVE_BSTRING_H
119 #define NO_LINGCLOSE
120
121 #elif defined(HIUX)
122 #define HAVE_SYS_RESOURCE_H
123 #undef HAVE_GMTOFF
124 #define NO_KILLPG
125 #undef NO_SETSID
126 #ifndef _HIUX_SOURCE
127 #define _HIUX_SOURCE
128 #endif
129 #define JMP_BUF sigjmp_buf
130 #define HAVE_SHMGET
131 #define SELECT_NEEDS_CAST
132
133 #elif defined(HPUX) || defined(HPUX10)
134 #define HAVE_SYS_RESOURCE_H
135 #undef HAVE_GMTOFF
136 #define NO_KILLPG
137 #undef NO_SETSID
138 #ifndef _HPUX_SOURCE
139 #define _HPUX_SOURCE
140 #endif
141 #define JMP_BUF sigjmp_buf
142 #define HAVE_SHMGET
143 #ifndef HPUX10
144 #define SELECT_NEEDS_CAST
145 typedef int rlim_t;
146 #endif
147
148 #elif defined(AIX)
149 #undef HAVE_GMTOFF
150 #undef NO_KILLPG
151 #undef NO_SETSID
152 #define HAVE_SYS_SELECT_H
153 #define JMP_BUF sigjmp_buf
154 #ifndef __ps2__
155 #define HAVE_MMAP
156 #define DEFAULT_GROUP "nobody"
157 #endif
158 #define DEFAULT_USER "nobody"
159 #ifdef NEED_RLIM_T
160 typedef int rlim_t;
161 #endif
162
163 #elif defined(ULTRIX)
164 #define HAVE_GMTOFF
165 #undef NO_KILLPG
166 #undef NO_SETSID
167 #define ULTRIX_BRAIN_DEATH
168 #define NEED_STRDUP
169 /* If you have Ultrix 4.3, and are using cc, const is broken */
170 #ifndef __ultrix__              /* Hack to check for pre-Ultrix 4.4 cc */
171 #define const                   /* Not implemented */
172 #endif
173 #define JMP_BUF sigjmp_buf
174
175 #elif defined(OSF1)
176 #define HAVE_GMTOFF
177 #undef NO_KILLPG
178 #undef NO_SETSID
179 #define JMP_BUF sigjmp_buf
180 #define HAVE_MMAP
181 #define HAVE_CRYPT_H
182 #define NO_LONG_DOUBLE
183
184 #elif defined(PARAGON)
185 #define HAVE_GMTOFF
186 #undef NO_KILLPG
187 #undef NO_SETSID
188 #define JMP_BUF sigjmp_buf
189 #define HAVE_MMAP
190 #define HAVE_CRYPT_H
191 #define NO_LONG_DOUBLE
192 typedef int rlim_t;
193
194 #elif defined(SEQUENT)
195 #define HAVE_GMTOFF
196 #undef NO_KILLPG
197 #define NO_SETSID
198 #define NEED_STRDUP
199 #define tolower(c) (isupper(c) ? tolower(c) : c)
200
201 #elif defined(NEXT)
202 typedef unsigned short mode_t;
203 #define HAVE_GMTOFF
204 #undef NO_KILLPG
205 #define NO_SETSID
206 #define NEED_STRDUP
207 #define NO_LINGCLOSE
208 #define NO_UNISTD_H
209 #undef _POSIX_SOURCE
210 #ifndef FD_CLOEXEC
211 #define FD_CLOEXEC 1
212 #endif
213 #ifndef S_ISDIR
214 #define S_ISDIR(m)      (((m)&(S_IFMT)) == (S_IFDIR))
215 #endif
216 #ifndef S_ISREG
217 #define S_ISREG(m)      (((m)&(S_IFMT)) == (S_IFREG))
218 #endif
219 #ifndef S_IXUSR
220 #define S_IXUSR 00100
221 #endif
222 #ifndef S_IRGRP
223 #define S_IRGRP 00040
224 #endif
225 #ifndef S_IXGRP
226 #define S_IXGRP 00010
227 #endif
228 #ifndef S_IROTH
229 #define S_IROTH 00004
230 #endif
231 #ifndef S_IXOTH
232 #define S_IXOTH 00001
233 #endif
234 #ifndef S_IRUSR
235 #define S_IRUSR S_IREAD
236 #endif
237 #ifndef S_IWUSR
238 #define S_IWUSR S_IWRITE
239 #endif
240 #ifndef S_IWGRP
241 #define S_IWGRP 000020
242 #endif
243 #ifndef S_IWOTH
244 #define S_IWOTH 000002
245 #ifndef rlim_t
246 typedef int rlim_t;
247 #endif
248 typedef u_long n_long;
249 #endif
250
251 #define STDIN_FILENO  0
252 #define STDOUT_FILENO 1
253 #define STDERR_FILENO 2
254 #define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
255 typedef int pid_t;
256 #define JMP_BUF jmp_buf
257 #define USE_LONGJMP
258 #define NO_USE_SIGACTION
259
260 #elif defined(LINUX)
261 #if LINUX > 1
262 #define HAVE_SHMGET
263 #define HAVE_SYS_RESOURCE_H
264 typedef int rlim_t;
265 #endif
266 #define USE_FCNTL_SERIALIZED_ACCEPT
267 #undef HAVE_GMTOFF
268 #undef NO_KILLPG
269 #undef NO_SETSID
270 #undef NEED_STRDUP
271 #define JMP_BUF sigjmp_buf
272 #include <sys/time.h>
273
274 #elif defined(SCO)
275 #undef HAVE_GMTOFF
276 #undef NO_KILLPG
277 #undef NO_SETSID
278 #define NEED_INITGROUPS
279 #define NO_WRITEV
280 #define JMP_BUF sigjmp_buf
281 #define SIGURG SIGUSR1          /* but note, this signal will be sent to a process group if enabled (for OOB data). It is not currently enabled. */
282 #include <sys/time.h>
283
284 #elif defined(SCO5)
285
286 #define JMP_BUF sigjmp_buf
287 #define SIGURG SIGUSR1
288 #define HAVE_SYS_SELECT_H
289 #define USE_FCNTL_SERIALIZED_ACCEPT
290 #define HAVE_MMAP
291 #define HAVE_SYS_RESOURCE_H
292 #define SecureWare
293
294 /* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
295 consts. Sigh. */
296 extern int strcasecmp(const char *, const char *);
297 extern int strncasecmp(const char *, const char *, unsigned);
298
299 #elif defined(AUX)
300 /* These are to let -Wall compile more cleanly */
301 extern int strcasecmp(const char *, const char *);
302 extern int strncasecmp(const char *, const char *, unsigned);
303 extern int set42sig(), getopt(), getpeername();
304 extern int listen(), bind(), socket(), getsockname();
305 extern int accept(), gethostname(), connect(), lstat();
306 extern int select(), killpg(), shutdown();
307 extern int initgroups(), setsockopt();
308 extern char *shmat();
309 extern int shmctl();
310 extern int shmget();
311 extern char *sbrk();
312 extern char *crypt();
313 #include <sys/time.h>
314 #undef HAVE_GMTOFF
315 #undef NO_KILLPG
316 #undef NO_SETSID
317 #define NEED_STRDUP
318 #define JMP_BUF sigjmp_buf
319 /* fcntl() locking is expensive with NFS */
320 #define USE_FLOCK_SERIALIZED_ACCEPT
321 #define HAVE_SHMGET
322 /*
323  * NOTE: If when you run Apache under A/UX and you get a warning
324  * that httpd couldn't move break, then the below value for
325  * MOVEBREAK (64megs) is too large for your setup. Try reducing
326  * to 0x2000000 which is still PLENTY of space. I doubt if
327  * even on heavy systems sbrk() would be called at all...
328  */
329 #define MOVEBREAK               0x4000000
330 #define NO_LINGCLOSE
331 #define NO_SLACK
332
333 #elif defined(SVR4)
334 #define NO_KILLPG
335 #undef  NO_SETSID
336 #undef NEED_STRDUP
337 #define NEED_STRCASECMP
338 #define NEED_STRNCASECMP
339 #define JMP_BUF sigjmp_buf
340 /* A lot of SVR4 systems need this */
341 #define USE_FCNTL_SERIALIZED_ACCEPT
342
343 #elif defined(UW)
344 #define NO_LINGCLOSE
345 #define NO_KILLPG
346 #undef  NO_SETSID
347 #undef NEED_STRDUP
348 #define NEED_STRCASECMP
349 #define NEED_STRNCASECMP
350 #define JMP_BUF sigjmp_buf
351 #define HAVE_RESOURCE
352 #define HAVE_MMAP
353 #define HAVE_SHMGET
354 #define HAVE_CRYPT_H
355 #define HAVE_SYS_SELECT_H
356 #define HAVE_SYS_RESOURCE_H
357 #include <sys/time.h>
358 #define _POSIX_SOURCE
359
360 #elif defined(DGUX)
361 #define NO_KILLPG
362 #undef  NO_SETSID
363 #undef NEED_STRDUP
364 #define NEED_STRCASECMP
365 #define NEED_STRNCASECMP
366 #define JMP_BUF sigjmp_buf
367 /* A lot of SVR4 systems need this */
368 #define USE_FCNTL_SERIALIZED_ACCEPT
369
370 #elif defined(__NetBSD__) || defined(__OpenBSD__)
371 #define HAVE_SYS_RESOURCE_H
372 #define HAVE_GMTOFF
373 #undef NO_KILLPG
374 #undef NO_SETSID
375 #define JMP_BUF sigjmp_buf
376 #define DEFAULT_USER "nobody"
377 #define DEFAULT_GROUP "nogroup"
378
379 #elif defined(UTS21)
380 #undef HAVE_GMTOFF
381 #undef NO_KILLPG
382 #define NO_SETSID
383 #define NEED_WAITPID
384 #define STDIN_FILENO 0
385 #define STDOUT_FILENO 1
386 #define STDERR_FILENO 2
387 #define strftime(buf,bufsize,fmt,tm)    ascftime(buf,fmt,tm)
388 #include <sys/types.h>
389
390 #elif defined(APOLLO)
391 #undef HAVE_GMTOFF
392 #undef NO_KILLPG
393 #undef NO_SETSID
394
395 #elif defined(__FreeBSD__) || defined(__bsdi__)
396 #if defined(__FreeBSD__)
397 #include <osreldate.h>
398 #endif
399 #define HAVE_SYS_RESOURCE_H
400 #define HAVE_GMTOFF
401 #undef NO_KILLPG
402 #undef NO_SETSID
403 #define JMP_BUF sigjmp_buf
404 #define HAVE_MMAP
405 #define DEFAULT_USER "nobody"
406 #define DEFAULT_GROUP "nogroup"
407 #if defined(__bsdi__)
408 typedef quad_t rlim_t;
409 #endif
410 #define USE_FLOCK_SERIALIZED_ACCEPT
411
412 #elif defined(QNX)
413 #ifndef crypt
414 char *crypt(const char *pw, const char *salt);
415 #endif
416 #ifndef initgroups
417 int initgroups(char *, int);
418 #endif
419 #ifndef strncasecmp
420 #define strncasecmp strnicmp
421 #endif
422 #undef NO_KILLPG
423 #undef NO_SETSID
424 #define NEED_INITGROUPS
425 #define NEED_SELECT_H
426 #define NEED_PROCESS_H
427 #define HAVE_SYS_SELECT_H
428 #include <unix.h>
429 #define JMP_BUF sigjmp_buf
430
431 #elif defined(LYNXOS)
432 #undef NO_KILLPG
433 #undef NO_SETSID
434 #define NEED_STRCASECMP
435 #define NEED_STRNCASECMP
436 #define NEED_INITGROUPS
437 #define JMP_BUF jmp_buf
438
439 #elif defined(UXPDS)
440 #undef NEED_STRCASECMP
441 #undef NEED_STRNCASECMP
442 #undef NEED_STRDUP
443 #undef HAVE_GMTOFF
444 #define NO_KILLPG
445 #undef NO_SETSID
446 #define HAVE_RESOURCE 1
447 #define JMP_BUF sigjmp_buf
448 #define USE_FCNTL_SERIALIZED_ACCEPT
449 #define HAVE_MMAP
450 #define HAVE_CRYPT_H
451
452 #elif defined(__EMX__)
453 /* Defines required for EMX OS/2 port. */
454 #define JMP_BUF sigjmp_buf
455 #define NO_KILLPG
456 #define NEED_STRCASECMP
457 #define NEED_STRNCASECMP
458 #define NO_SETSID
459 /* Add some drive name support */
460 #define chdir _chdir2
461 #include <sys/time.h>
462 #define MAXSOCKETS 4096
463 #define HAVE_MMAP
464
465 #elif defined(__MACHTEN__)
466 typedef int rlim_t;
467 #define JMP_BUF sigjmp_buf
468 #undef NO_KILLPG
469 #define NO_SETSID
470 #define HAVE_GMTOFF
471 #ifndef __MACHTEN_PPC__
472 #ifndef __MACHTEN_68K__
473 #define __MACHTEN_68K__
474 #endif
475 #define USE_FLOCK_SERIALIZED_ACCEPT
476 #define NO_USE_SIGACTION
477 #define USE_LONGJMP
478 #undef NEED_STRDUP
479 #else
480 #define HAVE_SHMGET
481 #define USE_FCNTL_SERIALIZED_ACCEPT
482 #endif
483
484 /* Convex OS v11 */
485 #elif defined(CONVEXOS11)
486 #undef HAVE_GMTOFF
487 #undef NO_KILLPG
488 #undef NO_SETSID
489 #undef NEED_STRDUP
490 #define HAVE_MMAP
491
492 #define NO_TIMEZONE
493 #include <stdio.h>
494 #include <sys/types.h>
495 #define JMP_BUF jmp_buf
496 typedef int rlim_t;
497
498 #elif defined(ISC)
499 #include <net/errno.h>
500 #define NO_KILLPG
501 #undef NO_SETSID
502 #define HAVE_SHMGET
503 #define SIGURG SIGUSR1
504 #define JMP_BUF sigjmp_buf
505 #define USE_FCNTL_SERIALIZED_ACCEPT
506
507 /* Unknown system - Edit these to match */
508 #else
509 #ifdef BSD
510 #define HAVE_GMTOFF
511 #else
512 #undef HAVE_GMTOFF
513 #endif
514 /* NO_KILLPG is set on systems that don't have killpg */
515 #undef NO_KILLPG
516 /* NO_SETSID is set on systems that don't have setsid */
517 #undef NO_SETSID
518 /* NEED_STRDUP is set on stupid systems that don't have strdup. */
519 #undef NEED_STRDUP
520 #endif
521
522 /* Do we have sys/resource.h; assume that BSD does. */
523 #ifndef HAVE_SYS_RESOURCE_H
524 #ifdef BSD
525 #define HAVE_SYS_RESOURCE_H
526 #endif
527 #endif /* HAVE_SYS_RESOURCE_H */
528
529 /*
530  * The particular directory style your system supports. If you have dirent.h
531  * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include
532  * that file and define DIR_TYPE to be dirent. Otherwise, if you have
533  * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
534  * file. If you have neither, I'm confused.
535  */
536
537 #include <sys/types.h>
538 #include <stdarg.h>
539 /*
540  * We use snprintf() to avoid overflows, but we include
541  * our own version (ap_snprintf). Allow for people to use their
542  * snprintf() if they want
543  */
544 #ifdef HAVE_SNPRINTF
545 #define ap_snprintf     snprintf
546 #define ap_vsnprintf    vsnprintf
547 #else
548 int ap_snprintf(char *buf, size_t len, const char *format, ...);
549 int ap_vsnprintf(char *buf, size_t len, const char *format, va_list ap);
550 #endif
551
552 #if !defined(NEXT)
553 #include <dirent.h>
554 #define DIR_TYPE dirent
555 #else
556 #include <sys/dir.h>
557 #define DIR_TYPE direct
558 #endif
559
560 #include <stdio.h>
561 #include <stdlib.h>
562 #include <string.h>
563 #include <sys/stat.h>
564 #ifndef MPE
565 #include <sys/file.h>
566 #endif
567 #include <sys/socket.h>
568 #ifdef HAVE_SYS_SELECT_H
569 #include <sys/select.h>
570 #endif
571 #include <ctype.h>
572 #include <netinet/in.h>
573 #include <netdb.h>
574 #include <sys/ioctl.h>
575 #ifndef MPE
576 #include <arpa/inet.h>          /* for inet_ntoa */
577 #endif
578 #include <time.h>               /* for ctime */
579 #include <signal.h>
580 #include <errno.h>
581 #include <sys/wait.h>
582 #include <pwd.h>
583 #include <grp.h>
584 #include <fcntl.h>
585 #include <limits.h>
586 #if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT)
587 #include <memory.h>
588 #endif
589 #ifdef NEED_PROCESS_H
590 #include <process.h>
591 #endif
592
593 #include <regex.h>
594
595 #ifdef HAVE_SYS_RESOURCE_H
596 #include <sys/resource.h>
597 #ifdef SUNOS4
598 int getrlimit(int, struct rlimit *);
599 int setrlimit(int, struct rlimit *);
600 #endif
601 #endif
602 #ifdef HAVE_MMAP
603 #ifndef __EMX__
604 /* This file is not needed for OS/2 */
605 #include <sys/mman.h>
606 #endif
607 #endif
608 #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
609 #define MAP_ANON MAP_ANONYMOUS
610 #endif
611
612 #if defined(HAVE_MMAP) && defined(NO_MMAP)
613 #undef HAVE_MMAP
614 #endif
615
616 #ifndef LOGNAME_MAX
617 #define LOGNAME_MAX 25
618 #endif
619
620 #ifndef NEXT
621 #include <unistd.h>
622 #endif
623
624 #ifdef ultrix
625 #define ULTRIX_BRAIN_DEATH
626 #endif
627
628 #ifndef S_ISLNK
629 #ifndef __EMX__
630 /* Don't define this for OS/2 */
631 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
632 #endif
633 #endif
634
635 #ifndef INADDR_NONE
636 #define INADDR_NONE ((unsigned long) -1)
637 #endif
638
639 /*
640  * Replace signal function with sigaction equivalent
641  */
642 #ifndef NO_USE_SIGACTION
643 typedef void Sigfunc(int);
644
645 #if defined(SIG_IGN) && !defined(SIG_ERR)
646 #define SIG_ERR ((Sigfunc *)-1)
647 #endif
648
649 /*
650  * For some strange reason, QNX defines signal to signal. Eliminate it.
651  */
652 #ifdef signal
653 #undef signal
654 #endif
655 #define signal(s,f)     ap_signal(s,f)
656 Sigfunc *signal(int signo, Sigfunc * func);
657 #endif
658
659 #include <setjmp.h>
660
661 #if defined(USE_LONGJMP)
662 #define ap_longjmp(x, y)        longjmp((x), (y))
663 #define ap_setjmp(x)            setjmp(x)
664 #else
665 #define ap_longjmp(x, y)        siglongjmp((x), (y))
666 #define ap_setjmp(x)            sigsetjmp((x), 1)
667 #endif
668
669 /* Finding offsets of elements within structures.
670  * Taken from the X code... they've sweated portability of this stuff
671  * so we don't have to.  Sigh...
672  */
673
674 #if defined(CRAY) || defined(__arm)
675 #if __STDC__
676 #define XtOffset(p_type,field) _Offsetof(p_type,field)
677 #else
678 #ifdef CRAY2
679 #define XtOffset(p_type,field) \
680         (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
681
682 #else /* !CRAY2 */
683
684 #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
685
686 #endif /* !CRAY2 */
687 #endif /* __STDC__ */
688 #else /* ! (CRAY || __arm) */
689
690 #define XtOffset(p_type,field) \
691         ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
692
693 #endif /* !CRAY */
694
695 #ifdef offsetof
696 #define XtOffsetOf(s_type,field) offsetof(s_type,field)
697 #else
698 #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
699 #endif
700
701 #ifdef SUNOS_LIB_PROTOTYPES
702 /* Prototypes needed to get a clean compile with gcc -Wall.
703  * Believe it or not, these do have to be declared, at least on SunOS,
704  * because they aren't mentioned in the relevant system headers.
705  * Sun Quality Software.  Gotta love it.
706  */
707
708 int getopt(int, char **, char *);
709
710 int strcasecmp(char *, char *);
711 int strncasecmp(char *, char *, int);
712 int toupper(int);
713 int tolower(int);
714
715 int printf(char *, ...);
716 int fprintf(FILE *, char *, ...);
717 int fputs(char *, FILE *);
718 int fread(char *, int, int, FILE *);
719 int fwrite(char *, int, int, FILE *);
720 int fflush(FILE *);
721 int fclose(FILE *);
722 int ungetc(int, FILE *);
723 int _filbuf(FILE *);            /* !!! */
724 int _flsbuf(unsigned char, FILE *);     /* !!! */
725 int sscanf(char *, char *, ...);
726 void setbuf(FILE *, char *);
727 void perror(char *);
728
729 time_t time(time_t *);
730 int strftime(char *, int, char *, struct tm *);
731
732 int initgroups(char *, int);
733 int wait3(int *, int, void *);  /* Close enough for us... */
734 int lstat(const char *, struct stat *);
735 int stat(const char *, struct stat *);
736 int flock(int, int);
737 #ifndef NO_KILLPG
738 int killpg(int, int);
739 #endif
740 int socket(int, int, int);
741 int setsockopt(int, int, int, const char *, int);
742 int listen(int, int);
743 int bind(int, struct sockaddr *, int);
744 int connect(int, struct sockaddr *, int);
745 int accept(int, struct sockaddr *, int *);
746 int shutdown(int, int);
747
748 int getsockname(int s, struct sockaddr *name, int *namelen);
749 int getpeername(int s, struct sockaddr *name, int *namelen);
750 int gethostname(char *name, int namelen);
751 void syslog(int, char *, ...);
752 char *mktemp(char *);
753
754 long vfprintf(FILE *, char *, va_list);
755
756 #endif