"Fossies" - the Fresh Open Source Software Archive 
Member "amavisd-milter-1.7.2/compat/compat.h" (27 Jan 2019, 3755 Bytes) of package /linux/privat/amavisd-milter-1.7.2.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /*
2 * Copyright (c) 2005, Petr Rehor <rx@rx.cz>. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. Neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
22 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef _AMAVISD_COMPAT_H
30 #define _AMAVISD_COMPAT_H
31
32 #ifdef HAVE_CONFIG_H
33 # include <config.h>
34 #endif
35
36 #if HAVE_STDBOOL_H
37 # include <stdbool.h>
38 #else
39 # if ! HAVE__BOOL
40 # ifdef __cplusplus
41 typedef bool _Bool;
42 # else
43 typedef unsigned char _Bool;
44 # endif
45 # endif
46 # define bool _Bool
47 # define false 0
48 # define true 1
49 # define __bool_true_false_are_defined 1
50 #endif
51
52 #include <errno.h>
53 #include <fcntl.h>
54 #include <libmilter/mfapi.h>
55 #include <libmilter/mfdef.h>
56 #include <limits.h>
57 #include <semaphore.h>
58 #include <stdio.h>
59 #include <stdlib.h>
60 #include <string.h>
61 #include <sys/param.h>
62 #include <sys/stat.h>
63 #include <sys/types.h>
64 #include <sys/un.h>
65 #include <syslog.h>
66 #include <unistd.h>
67
68 #if HAVE_DIRENT_H
69 # include <dirent.h>
70 #else
71 # define dirent direct
72 # if HAVE_SYS_NDIR_H
73 # include <sys/ndir.h>
74 # endif
75 # if HAVE_SYS_DIR_H
76 # include <sys/dir.h>
77 # endif
78 # if HAVE_NDIR_H
79 # include <ndir.h>
80 # endif
81 #endif
82
83 #if !defined(HAVE_DIRFD) && !defined(HAVE_DIRFD_AS_MACRO)
84 # if defined(HAVE_DIR_D_FD)
85 # define dirfd(_d) ((_d)->d_fd)
86 # elif defined(HAVE_DIR_DD_FD)
87 # define dirfd(_d) ((_d)->dd_fd)
88 # elif defined(HAVE_DIR___DD_FD)
89 # define dirfd(_d) ((_d)->__dd_fd)
90 # else
91 # error cannot figure out how to turn a DIR * into a fd
92 # endif
93 #endif
94
95 #if ! defined(MIN)
96 # define MIN(a, b) ((a) < (b) ? (a) : (b))
97 #endif
98 #if ! defined(MAX)
99 # define MAX(a, b) ((a) < (b) ? (b) : (a))
100 #endif
101
102 #if ! HAVE_DAEMON
103 # ifndef _PATH_DEVNULL
104 # define _PATH_DEVNULL "/dev/null"
105 # endif
106 /* Run detached from the controlling terminal */
107 extern int daemon(int, int);
108 #endif
109
110 #if HAVE_FTS_H
111 # include <fts.h>
112 #else
113 # include "fts_compat.h"
114 #endif
115
116 #if TIME_WITH_SYS_TIME
117 # include <sys/time.h>
118 # include <time.h>
119 #else
120 # if HAVE_SYS_TIME_H
121 # include <sys/time.h>
122 # else
123 # include <time.h>
124 # endif
125 #endif
126
127 #if ! HAVE_MKDTEMP
128 /* Make temporary directory */
129 extern char *mkdtemp(char *);
130 #endif
131
132 #if ! HAVE_STRLCPY
133 /* String copy */
134 extern size_t strlcpy(char *, const char *, size_t);
135 #endif
136
137 /* Secure socket handling */
138 extern ssize_t read_sock(int, void *, size_t, long);
139 extern ssize_t write_sock(int, void *, size_t, long);
140
141 #endif /* _AMAVISD_COMPAT_H */