2 805e39bf 2021-07-22 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
4 805e39bf 2021-07-22 op * Permission to use, copy, modify, and distribute this software for any
5 805e39bf 2021-07-22 op * purpose with or without fee is hereby granted, provided that the above
6 805e39bf 2021-07-22 op * copyright notice and this permission notice appear in all copies.
8 805e39bf 2021-07-22 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 805e39bf 2021-07-22 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 805e39bf 2021-07-22 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 805e39bf 2021-07-22 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 805e39bf 2021-07-22 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 805e39bf 2021-07-22 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 805e39bf 2021-07-22 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 805e39bf 2021-07-22 op #include <errno.h>
18 805e39bf 2021-07-22 op #include <stdarg.h>
19 805e39bf 2021-07-22 op #include <stdio.h>
20 805e39bf 2021-07-22 op #include <stdlib.h>
21 805e39bf 2021-07-22 op #include <string.h>
23 805e39bf 2021-07-22 op #include "compat.h"
25 805e39bf 2021-07-22 op static void vwarn(const char*, va_list);
26 805e39bf 2021-07-22 op static void vwarnx(const char*, va_list);
29 805e39bf 2021-07-22 op vwarn(const char *fmt, va_list ap)
31 805e39bf 2021-07-22 op fprintf(stderr, "%s: ", getprogname());
32 805e39bf 2021-07-22 op vfprintf(stderr, fmt, ap);
33 805e39bf 2021-07-22 op fprintf(stderr, ": %s\n", strerror(errno));
37 805e39bf 2021-07-22 op vwarnx(const char *fmt, va_list ap)
39 805e39bf 2021-07-22 op fprintf(stderr, "%s: ", getprogname());
40 805e39bf 2021-07-22 op vfprintf(stderr, fmt, ap);
41 805e39bf 2021-07-22 op fprintf(stderr, "\n");
45 805e39bf 2021-07-22 op err(int ret, const char *fmt, ...)
49 805e39bf 2021-07-22 op va_start(ap, fmt);
50 805e39bf 2021-07-22 op vwarn(fmt, ap);
56 805e39bf 2021-07-22 op errx(int ret, const char *fmt, ...)
60 805e39bf 2021-07-22 op va_start(ap, fmt);
61 805e39bf 2021-07-22 op vwarnx(fmt, ap);
67 805e39bf 2021-07-22 op warn(const char *fmt, ...)
71 805e39bf 2021-07-22 op va_start(ap, fmt);
72 805e39bf 2021-07-22 op vwarn(fmt, ap);
77 805e39bf 2021-07-22 op warnx(const char *fmt, ...)
81 805e39bf 2021-07-22 op va_start(ap, fmt);
82 805e39bf 2021-07-22 op vwarnx(fmt, ap);