2 f26f1205 2022-02-09 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
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.
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.
17 f26f1205 2022-02-09 op #ifndef COMPAT_H
18 f26f1205 2022-02-09 op #define COMPAT_H
20 f26f1205 2022-02-09 op #include "config.h"
22 f26f1205 2022-02-09 op #include <sys/types.h>
23 f26f1205 2022-02-09 op #include <sys/uio.h>
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>
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>
39 f26f1205 2022-02-09 op # include <event.h>
42 f26f1205 2022-02-09 op #ifdef HAVE_QUEUE_H
43 f26f1205 2022-02-09 op # include <sys/queue.h>
45 f26f1205 2022-02-09 op # include "compat/queue.h"
48 f26f1205 2022-02-09 op #ifdef HAVE_IMSG
49 f26f1205 2022-02-09 op # include <imsg.h>
51 f26f1205 2022-02-09 op # include "compat/imsg.h"
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>
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 f26f1205 2022-02-09 op int fmt_scaled(long long, char *);
63 f26f1205 2022-02-09 op #ifndef HAVE_ASPRINTF
64 f26f1205 2022-02-09 op int asprintf(char**, const char*, ...);
65 f26f1205 2022-02-09 op int vasprintf(char**, const char*, va_list);
68 f26f1205 2022-02-09 op #ifndef HAVE_ERR
69 f26f1205 2022-02-09 op void err(int, const char*, ...);
70 f26f1205 2022-02-09 op void errx(int, const char*, ...);
71 f26f1205 2022-02-09 op void warn(int, const char*, ...);
72 f26f1205 2022-02-09 op void warnx(int, const char*, ...);
74 f26f1205 2022-02-09 op # include <err.h>
77 f26f1205 2022-02-09 op #ifndef HAVE_EXPLICIT_BZERO
78 f26f1205 2022-02-09 op void explicit_bzero(void *, size_t);
81 f26f1205 2022-02-09 op #ifndef HAVE_FREEZERO
82 f26f1205 2022-02-09 op void freezero(void*, size_t);
85 f26f1205 2022-02-09 op #ifndef HAVE_GETDTABLECOUNT
86 f26f1205 2022-02-09 op int getdtablecount(void);
89 f26f1205 2022-02-09 op #ifndef HAVE_GETDTABLESIZE
90 f26f1205 2022-02-09 op int getdtablesize(void);
93 f26f1205 2022-02-09 op #ifndef HAVE_GETPROGNAME
94 f26f1205 2022-02-09 op const char *getprogname(void);
97 f26f1205 2022-02-09 op #ifndef HAVE_MEMMEM
98 f26f1205 2022-02-09 op void *memmem(const void*, size_t, const void*, size_t);
101 f26f1205 2022-02-09 op #ifndef HAVE_RECALLOCARRAY
102 f26f1205 2022-02-09 op void *recallocarray(void*, size_t, size_t, size_t);
105 f26f1205 2022-02-09 op #ifndef HAVE_STRCASESTR
106 f26f1205 2022-02-09 op char *strcasestr(const char *, const char *);
109 f26f1205 2022-02-09 op #ifndef HAVE_STRLCPY
110 f26f1205 2022-02-09 op size_t strlcpy(char*, const char*, size_t);
113 f26f1205 2022-02-09 op #ifndef HAVE_STRLCAT
114 f26f1205 2022-02-09 op size_t strlcat(char*, const char*, size_t);
117 f26f1205 2022-02-09 op #ifndef HAVE_STRSEP
118 f26f1205 2022-02-09 op char *strsep(char**, const char*);
121 f26f1205 2022-02-09 op #ifndef HAVE_STRTONUM
122 f26f1205 2022-02-09 op long long strtonum(const char*, long long, long long, const char**);
125 f26f1205 2022-02-09 op #ifndef HAVE_SETPROCTITLE
126 f26f1205 2022-02-09 op void setproctitle(const char*, ...);
129 f26f1205 2022-02-09 op #endif /* COMPAT_H */