]>
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 | * | |
22 | * $Id: stdinc.h 6 2005-09-10 01:02:21Z nenolod $ | |
23 | * | |
24 | */ | |
25 | ||
d56734d6 | 26 | #include "ratbox_lib.h" |
212380e3 | 27 | #include "config.h" /* Gotta pull in the autoconf stuff */ |
6e6a6326 | 28 | #include "ircd_defs.h" /* Needed for some reasons here -- dwr */ |
8669b3b9 | 29 | #include "irc_dictionary.h" |
212380e3 AC |
30 | |
31 | /* AIX requires this to be the first thing in the file. */ | |
32 | #ifdef __GNUC__ | |
33 | #undef alloca | |
34 | #define alloca __builtin_alloca | |
35 | #else | |
36 | # ifdef _MSC_VER | |
37 | # include <malloc.h> | |
38 | # define alloca _alloca | |
39 | # else | |
40 | # if HAVE_ALLOCA_H | |
41 | # include <alloca.h> | |
42 | # else | |
43 | # ifdef _AIX | |
44 | #pragma alloca | |
45 | # else | |
46 | # ifndef alloca /* predefined by HP cc +Olibcalls */ | |
47 | char *alloca (); | |
48 | # endif | |
49 | # endif | |
50 | # endif | |
51 | # endif | |
52 | #endif | |
53 | ||
54 | ||
55 | #ifdef HAVE_STDLIB_H | |
56 | #include <stdlib.h> | |
57 | #endif | |
58 | #ifdef STRING_WITH_STRINGS | |
59 | # include <string.h> | |
60 | # include <strings.h> | |
61 | #else | |
62 | # ifdef HAVE_STRING_H | |
63 | # include <string.h> | |
64 | # else | |
65 | # ifdef HAVE_STRINGS_H | |
66 | # include <strings.h> | |
67 | # endif | |
68 | # endif | |
69 | #endif | |
70 | ||
71 | ||
72 | #ifdef HAVE_STDDEF_H | |
73 | #include <stddef.h> | |
74 | #endif | |
75 | ||
76 | ||
77 | ||
78 | #include <stdio.h> | |
79 | #include <assert.h> | |
80 | #include <stdio.h> | |
81 | #include <time.h> | |
82 | #include <fcntl.h> | |
83 | #include <netdb.h> | |
84 | #include <stdarg.h> | |
85 | #include <signal.h> | |
86 | #include <dirent.h> | |
87 | #include <ctype.h> | |
88 | ||
89 | #include <limits.h> | |
90 | ||
91 | #ifdef HAVE_UNISTD_H | |
92 | #include <unistd.h> | |
93 | #endif | |
94 | ||
95 | #include <sys/time.h> | |
96 | #include <sys/types.h> | |
97 | #include <sys/file.h> | |
98 | #ifdef HAVE_SYS_RESOURCE_H | |
99 | #include <sys/resource.h> | |
100 | #endif | |
101 | ||
102 | ||
103 | #include <sys/socket.h> | |
104 | #include <sys/stat.h> | |
105 | #include <sys/wait.h> | |
106 | ||
107 | #ifdef HAVE_SYS_PARAM_H | |
108 | #include <sys/param.h> | |
109 | #endif | |
110 | #include <netinet/in.h> | |
111 | #include <netinet/tcp.h> | |
112 | #include <arpa/inet.h> | |
113 | ||
114 | #ifdef HAVE_ERRNO_H | |
115 | #include <errno.h> | |
116 | #else | |
117 | extern int errno; | |
118 | #endif | |
119 | ||
120 | #ifdef HAVE_SYS_UIO_H | |
121 | #include <sys/uio.h> | |
122 | #endif | |
123 | ||
124 | #if defined(__INTEL_COMPILER) || defined(__GNUC__) | |
125 | # ifdef __unused | |
126 | # undef __unused | |
127 | # endif | |
128 | # ifdef __printf | |
129 | # undef __printf | |
130 | # endif | |
131 | # ifdef __noreturn | |
132 | # undef __noreturn | |
133 | # endif | |
134 | ||
135 | # define __unused __attribute__((__unused__)) | |
136 | # define __printf(x) __attribute__((__format__ (__printf__, x, x + 1))) | |
137 | # define __noreturn __attribute__((__noreturn__)) | |
138 | #else | |
139 | # define __unused | |
140 | # define __printf | |
141 | # define __noreturn | |
142 | #endif | |
143 | ||
ae78a571 VY |
144 | |
145 | ||
212380e3 AC |
146 | #ifdef strdupa |
147 | #define LOCAL_COPY(s) strdupa(s) | |
148 | #else | |
149 | #if defined(__INTEL_COMPILER) || defined(__GNUC__) | |
150 | # define LOCAL_COPY(s) __extension__({ char *_s = alloca(strlen(s) + 1); strcpy(_s, s); _s; }) | |
151 | #else | |
152 | # define LOCAL_COPY(s) strcpy(alloca(strlen(s) + 1), s) /* XXX Is that allowed? */ | |
153 | #endif /* defined(__INTEL_COMPILER) || defined(__GNUC__) */ | |
154 | #endif /* strdupa */ |