2 8951cb19 2022-07-01 op * Copyright (c) 1993
3 8951cb19 2022-07-01 op * The Regents of the University of California. All rights reserved.
5 8951cb19 2022-07-01 op * Redistribution and use in source and binary forms, with or without
6 8951cb19 2022-07-01 op * modification, are permitted provided that the following conditions
8 8951cb19 2022-07-01 op * 1. Redistributions of source code must retain the above copyright
9 8951cb19 2022-07-01 op * notice, this list of conditions and the following disclaimer.
10 8951cb19 2022-07-01 op * 2. Redistributions in binary form must reproduce the above copyright
11 8951cb19 2022-07-01 op * notice, this list of conditions and the following disclaimer in the
12 8951cb19 2022-07-01 op * documentation and/or other materials provided with the distribution.
13 8951cb19 2022-07-01 op * 3. Neither the name of the University nor the names of its contributors
14 8951cb19 2022-07-01 op * may be used to endorse or promote products derived from this software
15 8951cb19 2022-07-01 op * without specific prior written permission.
17 8951cb19 2022-07-01 op * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 8951cb19 2022-07-01 op * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 8951cb19 2022-07-01 op * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 8951cb19 2022-07-01 op * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 8951cb19 2022-07-01 op * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 8951cb19 2022-07-01 op * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 8951cb19 2022-07-01 op * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 8951cb19 2022-07-01 op * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 8951cb19 2022-07-01 op * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 8951cb19 2022-07-01 op * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 8951cb19 2022-07-01 op * SUCH DAMAGE.
30 f164f2f4 2022-07-01 op #include "config.h"
32 8951cb19 2022-07-01 op #include <errno.h>
33 8951cb19 2022-07-01 op #include <stdarg.h>
34 8951cb19 2022-07-01 op #include <stdio.h>
35 8951cb19 2022-07-01 op #include <stdlib.h>
36 8951cb19 2022-07-01 op #include <string.h>
39 8951cb19 2022-07-01 op vwarnx(const char *fmt, va_list ap)
41 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
42 8951cb19 2022-07-01 op if (fmt != NULL)
43 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
44 8951cb19 2022-07-01 op fprintf(stderr, "\n");
48 8951cb19 2022-07-01 op vwarnc(int code, const char *fmt, va_list ap)
50 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
51 8951cb19 2022-07-01 op if (fmt != NULL) {
52 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
53 8951cb19 2022-07-01 op fprintf(stderr, ": ");
55 8951cb19 2022-07-01 op fprintf(stderr, "%s\n", strerror(code));
59 8951cb19 2022-07-01 op vwarn(const char *fmt, va_list ap)
63 8951cb19 2022-07-01 op sverrno = errno;
64 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
65 8951cb19 2022-07-01 op if (fmt != NULL) {
66 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
67 8951cb19 2022-07-01 op fprintf(stderr, ": ");
69 8951cb19 2022-07-01 op fprintf(stderr, "%s\n", strerror(sverrno));
73 8951cb19 2022-07-01 op verrc(int eval, int code, const char *fmt, va_list ap)
75 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
76 8951cb19 2022-07-01 op if (fmt != NULL) {
77 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
78 8951cb19 2022-07-01 op fprintf(stderr, ": ");
80 8951cb19 2022-07-01 op fprintf(stderr, "%s\n", strerror(code));
85 8951cb19 2022-07-01 op verrx(int eval, const char *fmt, va_list ap)
87 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
88 8951cb19 2022-07-01 op if (fmt != NULL)
89 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
90 8951cb19 2022-07-01 op fprintf(stderr, "\n");
95 8951cb19 2022-07-01 op verr(int eval, const char *fmt, va_list ap)
99 8951cb19 2022-07-01 op sverrno = errno;
100 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
101 8951cb19 2022-07-01 op if (fmt != NULL) {
102 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
103 8951cb19 2022-07-01 op fprintf(stderr, ": ");
105 8951cb19 2022-07-01 op fprintf(stderr, "%s\n", strerror(sverrno));
110 8951cb19 2022-07-01 op err(int eval, const char *fmt, ...)
114 8951cb19 2022-07-01 op va_start(ap, fmt);
115 8951cb19 2022-07-01 op verr(eval, fmt, ap);
120 8951cb19 2022-07-01 op errc(int eval, int code, const char *fmt, ...)
124 8951cb19 2022-07-01 op va_start(ap, fmt);
125 8951cb19 2022-07-01 op verrc(eval, code, fmt, ap);
130 8951cb19 2022-07-01 op errx(int eval, const char *fmt, ...)
134 8951cb19 2022-07-01 op va_start(ap, fmt);
135 8951cb19 2022-07-01 op verrx(eval, fmt, ap);
140 8951cb19 2022-07-01 op warn(const char *fmt, ...)
144 8951cb19 2022-07-01 op va_start(ap, fmt);
145 8951cb19 2022-07-01 op vwarn(fmt, ap);
150 8951cb19 2022-07-01 op warnc(int code, const char *fmt, ...)
154 8951cb19 2022-07-01 op va_start(ap, fmt);
155 8951cb19 2022-07-01 op vwarnc(code, fmt, ap);
160 8951cb19 2022-07-01 op warnx(const char *fmt, ...)
164 8951cb19 2022-07-01 op va_start(ap, fmt);
165 8951cb19 2022-07-01 op vwarnx(fmt, ap);