/[hydra]/hydra/src/compat.h
ViewVC logotype

Contents of /hydra/src/compat.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Wed Oct 2 13:48:35 2002 UTC (21 years, 6 months ago) by nmav
Branch: MAIN
CVS Tags: hydra_0_0_6
Changes since 1.1: +6 -4 lines
File MIME type: text/plain
Added compatibility function implementations such as scandir(), strstr() etc, in src/. Scandir implementation was replaced by the one in gnu libc.

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.1.1.1 2002/09/21 13:53:38 nmav 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 (
103 const char *dir,
104 struct dirent ***namelist,
105 int (*select) (const struct dirent *),
106 int (*cmp) (const void *, const void *));
107 #endif
108
109 #ifndef HAVE_ALPHASORT
110 int alphasort(const struct dirent **a, const struct dirent **b);
111 #endif
112
113 #ifndef HAVE_STRSTR
114 char *strstr(char *s1, char *s2);
115 #endif
116
117 #ifndef HAVE_STRDUP
118 char *strdup(char *s);
119 #endif
120
121 #ifdef HAVE_TM_GMTOFF
122 #define TIMEZONE_OFFSET(foo) foo##->tm_gmtoff
123 #else
124 #define TIMEZONE_OFFSET(foo) timezone
125 #endif
126
127 #ifdef HAVE_TM_ZONE
128 #define TIMEZONE(foo) foo##->tm_zone
129 #else
130 #define TIMEZONE(foo) *tzname
131 #endif
132
133 #ifdef HAVE_LIBDMALLOC
134 #define DMALLOC_FUNC_CHECK
135 #include <dmalloc.h>
136 #endif
137
138 #ifdef HAVE_GETOPT_H
139 #include <getopt.h>
140 #endif
141
142 #endif

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26