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