]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* |
2 | * ircd-ratbox: A slightly useful ircd. | |
3 | * stdinc.h: Pull in all of the necessary system headers | |
4 | * | |
5 | * Copyright (C) 2002 Aaron Sethman <androsyn@ratbox.org> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
20 | * USA | |
21 | * | |
212380e3 AC |
22 | */ |
23 | ||
fe037171 | 24 | #include "rb_lib.h" |
212380e3 | 25 | #include "config.h" /* Gotta pull in the autoconf stuff */ |
6e6a6326 | 26 | #include "ircd_defs.h" /* Needed for some reasons here -- dwr */ |
212380e3 AC |
27 | |
28 | /* AIX requires this to be the first thing in the file. */ | |
29 | #ifdef __GNUC__ | |
30 | #undef alloca | |
31 | #define alloca __builtin_alloca | |
32 | #else | |
33 | # ifdef _MSC_VER | |
34 | # include <malloc.h> | |
35 | # define alloca _alloca | |
36 | # else | |
37 | # if HAVE_ALLOCA_H | |
38 | # include <alloca.h> | |
39 | # else | |
40 | # ifdef _AIX | |
41 | #pragma alloca | |
42 | # else | |
43 | # ifndef alloca /* predefined by HP cc +Olibcalls */ | |
44 | char *alloca (); | |
45 | # endif | |
46 | # endif | |
47 | # endif | |
48 | # endif | |
49 | #endif | |
55abcbb2 | 50 | |
212380e3 AC |
51 | |
52 | #ifdef HAVE_STDLIB_H | |
53 | #include <stdlib.h> | |
54 | #endif | |
55 | #ifdef STRING_WITH_STRINGS | |
56 | # include <string.h> | |
57 | # include <strings.h> | |
58 | #else | |
59 | # ifdef HAVE_STRING_H | |
60 | # include <string.h> | |
61 | # else | |
62 | # ifdef HAVE_STRINGS_H | |
63 | # include <strings.h> | |
64 | # endif | |
65 | # endif | |
66 | #endif | |
67 | ||
68 | ||
69 | #ifdef HAVE_STDDEF_H | |
70 | #include <stddef.h> | |
71 | #endif | |
72 | ||
73 | ||
07554369 EM |
74 | #ifdef HAVE_STDBOOL_H |
75 | # include <stdbool.h> | |
76 | #else | |
77 | # ifndef HAVE__BOOL | |
78 | # ifdef __cplusplus | |
79 | typedef bool _Bool; | |
80 | # else | |
81 | # define _Bool signed char | |
82 | # endif | |
83 | # endif | |
84 | # define bool _Bool | |
85 | # define false 0 | |
86 | # define true 1 | |
87 | # define __bool_true_false_are_defined 1 | |
88 | #endif | |
89 | ||
212380e3 AC |
90 | |
91 | #include <stdio.h> | |
92 | #include <assert.h> | |
93 | #include <stdio.h> | |
94 | #include <time.h> | |
95 | #include <fcntl.h> | |
96 | #include <netdb.h> | |
97 | #include <stdarg.h> | |
98 | #include <signal.h> | |
99 | #include <dirent.h> | |
100 | #include <ctype.h> | |
101 | ||
102 | #include <limits.h> | |
103 | ||
104 | #ifdef HAVE_UNISTD_H | |
105 | #include <unistd.h> | |
106 | #endif | |
107 | ||
108 | #include <sys/time.h> | |
109 | #include <sys/types.h> | |
110 | #include <sys/file.h> | |
111 | #ifdef HAVE_SYS_RESOURCE_H | |
112 | #include <sys/resource.h> | |
113 | #endif | |
114 | ||
115 | ||
116 | #include <sys/socket.h> | |
117 | #include <sys/stat.h> | |
118 | #include <sys/wait.h> | |
119 | ||
120 | #ifdef HAVE_SYS_PARAM_H | |
121 | #include <sys/param.h> | |
122 | #endif | |
123 | #include <netinet/in.h> | |
124 | #include <netinet/tcp.h> | |
125 | #include <arpa/inet.h> | |
126 | ||
127 | #ifdef HAVE_ERRNO_H | |
128 | #include <errno.h> | |
129 | #else | |
130 | extern int errno; | |
131 | #endif | |
132 | ||
133 | #ifdef HAVE_SYS_UIO_H | |
134 | #include <sys/uio.h> | |
135 | #endif | |
136 | ||
137 | #if defined(__INTEL_COMPILER) || defined(__GNUC__) | |
138 | # ifdef __unused | |
139 | # undef __unused | |
140 | # endif | |
141 | # ifdef __printf | |
142 | # undef __printf | |
143 | # endif | |
144 | # ifdef __noreturn | |
145 | # undef __noreturn | |
146 | # endif | |
147 | ||
148 | # define __unused __attribute__((__unused__)) | |
149 | # define __printf(x) __attribute__((__format__ (__printf__, x, x + 1))) | |
150 | # define __noreturn __attribute__((__noreturn__)) | |
151 | #else | |
152 | # define __unused | |
153 | # define __printf | |
154 | # define __noreturn | |
155 | #endif | |
156 | ||
ae78a571 VY |
157 | |
158 | ||
212380e3 | 159 | #ifdef strdupa |
55abcbb2 | 160 | #define LOCAL_COPY(s) strdupa(s) |
212380e3 AC |
161 | #else |
162 | #if defined(__INTEL_COMPILER) || defined(__GNUC__) | |
163 | # define LOCAL_COPY(s) __extension__({ char *_s = alloca(strlen(s) + 1); strcpy(_s, s); _s; }) | |
164 | #else | |
165 | # define LOCAL_COPY(s) strcpy(alloca(strlen(s) + 1), s) /* XXX Is that allowed? */ | |
166 | #endif /* defined(__INTEL_COMPILER) || defined(__GNUC__) */ | |
167 | #endif /* strdupa */ |