1 |
nmav |
1.1 |
/* |
2 |
|
|
* Boa, an http server |
3 |
|
|
* Copyright (C) 1995 Paul Phillips <paulp@go2net.com> |
4 |
|
|
* Some changes Copyright (C) 1999-2000 Jon Nelson <jnelson@boa.org> |
5 |
|
|
* and Larry Doolittle <ldoolitt@boa.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 1, or (at your option) |
10 |
|
|
* 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., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 |
|
|
* |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
/* $Id: compat.h,v 1.18.2.1 2002/06/06 05:02:28 jnelson Exp $*/ |
24 |
|
|
|
25 |
|
|
#ifndef _COMPAT_H |
26 |
|
|
#define _COMPAT_H |
27 |
|
|
|
28 |
|
|
#include "config.h" |
29 |
|
|
|
30 |
|
|
#ifdef TIME_WITH_SYS_TIME |
31 |
|
|
#include <sys/time.h> |
32 |
|
|
#endif |
33 |
|
|
|
34 |
|
|
#ifdef HAVE_SYS_FCNTL_H |
35 |
|
|
#include <sys/fcntl.h> |
36 |
|
|
#endif |
37 |
|
|
|
38 |
|
|
#ifndef OPEN_MAX |
39 |
|
|
#define OPEN_MAX 256 |
40 |
|
|
#endif |
41 |
|
|
|
42 |
|
|
#ifndef NI_MAXHOST |
43 |
|
|
#define NI_MAXHOST 20 |
44 |
|
|
#endif |
45 |
|
|
|
46 |
|
|
#include <sys/socket.h> |
47 |
|
|
#ifndef SO_MAXCONN |
48 |
|
|
#define SO_MAXCONN 250 |
49 |
|
|
#endif |
50 |
|
|
|
51 |
|
|
#ifndef PATH_MAX |
52 |
|
|
#define PATH_MAX 2048 |
53 |
|
|
#endif |
54 |
|
|
|
55 |
|
|
/* Wild guess time, probably better done with configure */ |
56 |
|
|
#ifdef O_NONBLOCK |
57 |
|
|
#define NOBLOCK O_NONBLOCK /* Linux */ |
58 |
|
|
#else /* O_NONBLOCK */ |
59 |
|
|
#ifdef O_NDELAY |
60 |
|
|
#define NOBLOCK O_NDELAY /* Sun */ |
61 |
|
|
#else /* O_NDELAY */ |
62 |
|
|
#error "Can't find a way to #define NOBLOCK" |
63 |
|
|
#endif /* O_NDELAY */ |
64 |
|
|
#endif /* O_NONBLOCK */ |
65 |
|
|
|
66 |
|
|
#ifndef MAP_FILE |
67 |
|
|
#define MAP_OPTIONS MAP_SHARED /* Sun */ |
68 |
|
|
#else |
69 |
|
|
#define MAP_OPTIONS MAP_FILE|MAP_SHARED /* Linux */ |
70 |
|
|
#endif |
71 |
|
|
|
72 |
|
|
#ifdef INET6 |
73 |
|
|
#define SOCKADDR sockaddr_storage |
74 |
|
|
#define S_FAMILY __s_family |
75 |
|
|
#define SERVER_AF AF_INET6 |
76 |
|
|
#else |
77 |
|
|
#define SOCKADDR sockaddr_in |
78 |
|
|
#define S_FAMILY sin_family |
79 |
|
|
#define SERVER_AF AF_INET |
80 |
|
|
#endif |
81 |
|
|
|
82 |
|
|
#if HAVE_DIRENT_H |
83 |
|
|
# include <dirent.h> |
84 |
|
|
# define NAMLEN(dirent) strlen((dirent)->d_name) |
85 |
|
|
#else |
86 |
|
|
# define dirent direct |
87 |
|
|
# define NAMLEN(dirent) (dirent)->d_namlen |
88 |
|
|
# if HAVE_SYS_NDIR_H |
89 |
|
|
# include <sys/ndir.h> |
90 |
|
|
# endif |
91 |
|
|
# if HAVE_SYS_DIR_H |
92 |
|
|
# include <sys/dir.h> |
93 |
|
|
# endif |
94 |
|
|
# if HAVE_NDIR_H |
95 |
|
|
# include <ndir.h> |
96 |
|
|
# endif |
97 |
|
|
#endif |
98 |
|
|
|
99 |
|
|
/* below here, functions are provided in extras */ |
100 |
|
|
#ifndef HAVE_SCANDIR |
101 |
|
|
int |
102 |
|
|
scandir(const char *dir, struct dirent ***namelist, |
103 |
|
|
int (*select) (const struct dirent *), |
104 |
|
|
int (*compar) (const struct dirent **, const struct dirent **)); |
105 |
|
|
#endif |
106 |
|
|
|
107 |
|
|
#ifndef HAVE_ALPHASORT |
108 |
|
|
int alphasort(const struct dirent **a, const struct dirent **b); |
109 |
|
|
#endif |
110 |
|
|
|
111 |
|
|
#ifndef HAVE_STRSTR |
112 |
|
|
char *strstr(char *s1, char *s2); |
113 |
|
|
#endif |
114 |
|
|
|
115 |
|
|
#ifndef HAVE_STRDUP |
116 |
|
|
char *strdup(char *s); |
117 |
|
|
#endif |
118 |
|
|
|
119 |
|
|
#ifdef HAVE_TM_GMTOFF |
120 |
|
|
#define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff |
121 |
|
|
#else |
122 |
|
|
#define TIMEZONE_OFFSET(foo) timezone |
123 |
|
|
#endif |
124 |
|
|
|
125 |
|
|
#ifdef HAVE_TM_ZONE |
126 |
|
|
#define TIMEZONE(foo) foo##->tm_zone |
127 |
|
|
#else |
128 |
|
|
#define TIMEZONE(foo) *tzname |
129 |
|
|
#endif |
130 |
|
|
|
131 |
|
|
#ifdef HAVE_LIBDMALLOC |
132 |
|
|
#define DMALLOC_FUNC_CHECK |
133 |
|
|
#include <dmalloc.h> |
134 |
|
|
#endif |
135 |
|
|
|
136 |
|
|
#ifdef HAVE_GETOPT_H |
137 |
|
|
#include <getopt.h> |
138 |
|
|
#endif |
139 |
|
|
|
140 |
|
|
#endif |