Blame


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