comparison extern/libcompat/src/vsyslog.c @ 948:21a91311c8ea

cmake: switch back, GNU make is painful
author David Demelier <markand@malikania.fr>
date Sat, 16 Jan 2021 17:58:46 +0100
parents
children cf99df45cb84
comparison
equal deleted inserted replaced
947:95201fd9ad88 948:21a91311c8ea
1 /*
2 * vsyslog.c -- fallback implementation
3 *
4 * Copyright (c) 2020 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #include "compat.h"
20
21 #if defined(COMPAT_HAVE_SYSLOG_H)
22
23 #include <assert.h>
24 #include <stdarg.h>
25 #include <stdio.h>
26 #include <syslog.h>
27
28 void
29 vsyslog(int priority, const char *msg, va_list ap)
30 {
31 assert(msg);
32
33 char buf[1024] = {0};
34
35 if (vsnprintf(buf, sizeof (buf), fmt, ap) >= 0)
36 syslog(priority, "%s", buf);
37 }
38
39 #endif