Blame


1 b0003f58 2021-03-08 op /*
2 b0003f58 2021-03-08 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 b0003f58 2021-03-08 op *
4 b0003f58 2021-03-08 op * Permission to use, copy, modify, and distribute this software for any
5 b0003f58 2021-03-08 op * purpose with or without fee is hereby granted, provided that the above
6 b0003f58 2021-03-08 op * copyright notice and this permission notice appear in all copies.
7 b0003f58 2021-03-08 op *
8 b0003f58 2021-03-08 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 b0003f58 2021-03-08 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 b0003f58 2021-03-08 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 b0003f58 2021-03-08 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 b0003f58 2021-03-08 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 b0003f58 2021-03-08 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 b0003f58 2021-03-08 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 b0003f58 2021-03-08 op */
16 b0003f58 2021-03-08 op
17 b0003f58 2021-03-08 op #ifndef COMPAT_H
18 b0003f58 2021-03-08 op #define COMPAT_H
19 b0003f58 2021-03-08 op
20 60c891c2 2021-03-12 op #include "config.h"
21 60c891c2 2021-03-12 op
22 b0003f58 2021-03-08 op #include <sys/types.h>
23 b0003f58 2021-03-08 op #include <sys/uio.h>
24 b0003f58 2021-03-08 op
25 b0003f58 2021-03-08 op #include <stdarg.h>
26 82550776 2021-03-17 op #include <stddef.h>
27 b0003f58 2021-03-08 op #include <stdint.h>
28 b0003f58 2021-03-08 op
29 1470eab3 2021-07-27 op #if HAVE_EVENT2
30 1470eab3 2021-07-27 op # include <event2/event.h>
31 1470eab3 2021-07-27 op # include <event2/event_compat.h>
32 1470eab3 2021-07-27 op # include <event2/event_struct.h>
33 1470eab3 2021-07-27 op # include <event2/buffer.h>
34 1470eab3 2021-07-27 op # include <event2/buffer_compat.h>
35 1470eab3 2021-07-27 op # include <event2/bufferevent.h>
36 1470eab3 2021-07-27 op # include <event2/bufferevent_struct.h>
37 1470eab3 2021-07-27 op # include <event2/bufferevent_compat.h>
38 1470eab3 2021-07-27 op #else
39 1470eab3 2021-07-27 op # include <event.h>
40 1470eab3 2021-07-27 op # define evbuffer_freeze(a, b) /* nop */
41 1470eab3 2021-07-27 op # define evbuffer_unfreeze(a, b) /* nop */
42 1470eab3 2021-07-27 op #endif
43 1470eab3 2021-07-27 op
44 b0003f58 2021-03-08 op #ifdef HAVE_QUEUE_H
45 b0003f58 2021-03-08 op # include <sys/queue.h>
46 b0003f58 2021-03-08 op #else
47 b0003f58 2021-03-08 op # include "compat/queue.h"
48 b0003f58 2021-03-08 op #endif
49 b0003f58 2021-03-08 op
50 b0003f58 2021-03-08 op #ifdef HAVE_LIBUTIL
51 b0003f58 2021-03-08 op # include <imsg.h>
52 82550776 2021-03-17 op # include <ohash.h>
53 0e1eff5b 2021-06-23 op # include <util.h>
54 b0003f58 2021-03-08 op #else
55 b0003f58 2021-03-08 op # include "compat/imsg.h"
56 82550776 2021-03-17 op # include "compat/ohash.h"
57 0e1eff5b 2021-06-23 op # define FMT_SCALED_STRSIZE 7 /* minus sign, 4 digits, suffix, null byte */
58 0e1eff5b 2021-06-23 op int fmt_scaled(long long, char *);
59 b0003f58 2021-03-08 op #endif
60 b0003f58 2021-03-08 op
61 b0003f58 2021-03-08 op #ifndef HAVE_ASPRINTF
62 b0003f58 2021-03-08 op int asprintf(char**, const char*, ...);
63 b0003f58 2021-03-08 op int vasprintf(char**, const char*, va_list);
64 b0003f58 2021-03-08 op #endif
65 b0003f58 2021-03-08 op
66 b0003f58 2021-03-08 op #ifndef HAVE_ERR
67 b0003f58 2021-03-08 op void err(int, const char*, ...);
68 b0003f58 2021-03-08 op void errx(int, const char*, ...);
69 b0003f58 2021-03-08 op void warn(int, const char*, ...);
70 b0003f58 2021-03-08 op void warnx(int, const char*, ...);
71 f4aa8eb5 2021-03-18 op #else
72 f4aa8eb5 2021-03-18 op # include <err.h>
73 b0003f58 2021-03-08 op #endif
74 b0003f58 2021-03-08 op
75 b0003f58 2021-03-08 op #ifndef HAVE_FREEZERO
76 b0003f58 2021-03-08 op void freezero(void*, size_t);
77 b0003f58 2021-03-08 op #endif
78 b0003f58 2021-03-08 op
79 b0003f58 2021-03-08 op #ifndef HAVE_GETDTABLECOUNT
80 b0003f58 2021-03-08 op int getdtablecount(void);
81 b0003f58 2021-03-08 op #endif
82 b0003f58 2021-03-08 op
83 b0003f58 2021-03-08 op #ifndef HAVE_GETDTABLESIZE
84 b0003f58 2021-03-08 op int getdtablesize(void);
85 b0003f58 2021-03-08 op #endif
86 b0003f58 2021-03-08 op
87 60c891c2 2021-03-12 op #ifndef HAVE_GETPROGNAME
88 60c891c2 2021-03-12 op const char *getprogname(void);
89 60c891c2 2021-03-12 op #endif
90 60c891c2 2021-03-12 op
91 e21e40a9 2021-03-13 op #ifndef HAVE_MEMMEM
92 e21e40a9 2021-03-13 op void *memmem(const void*, size_t, const void*, size_t);
93 e21e40a9 2021-03-13 op #endif
94 e21e40a9 2021-03-13 op
95 60c891c2 2021-03-12 op #ifndef HAVE_RECALLOCARRAY
96 60c891c2 2021-03-12 op void *recallocarray(void*, size_t, size_t, size_t);
97 60c891c2 2021-03-12 op #endif
98 60c891c2 2021-03-12 op
99 e80a23a1 2021-07-14 op #ifndef HAVE_STRCASESTR
100 e80a23a1 2021-07-14 op char *strcasestr(const char *, const char *);
101 e80a23a1 2021-07-14 op #endif
102 e80a23a1 2021-07-14 op
103 b0003f58 2021-03-08 op #ifndef HAVE_STRLCPY
104 b0003f58 2021-03-08 op size_t strlcpy(char*, const char*, size_t);
105 b0003f58 2021-03-08 op #endif
106 b0003f58 2021-03-08 op
107 b0003f58 2021-03-08 op #ifndef HAVE_STRLCAT
108 b0003f58 2021-03-08 op size_t strlcat(char*, const char*, size_t);
109 b0003f58 2021-03-08 op #endif
110 b0003f58 2021-03-08 op
111 fbaf9fba 2021-04-25 op #ifndef HAVE_STRSEP
112 fbaf9fba 2021-04-25 op char *strsep(char**, const char*);
113 fbaf9fba 2021-04-25 op #endif
114 fbaf9fba 2021-04-25 op
115 b0003f58 2021-03-08 op #ifndef HAVE_STRTONUM
116 31753df0 2021-03-18 op long long strtonum(const char*, long long, long long, const char**);
117 b0003f58 2021-03-08 op #endif
118 b0003f58 2021-03-08 op
119 b0003f58 2021-03-08 op #ifndef HAVE_SETPROCTITLE
120 b0003f58 2021-03-08 op void setproctitle(const char*, ...);
121 b0003f58 2021-03-08 op #endif
122 b0003f58 2021-03-08 op
123 b0003f58 2021-03-08 op #endif /* COMPAT_H */