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 8951cb19 2022-07-01 op #include <errno.h>
31 8951cb19 2022-07-01 op #include <stdarg.h>
32 8951cb19 2022-07-01 op #include <stdio.h>
33 8951cb19 2022-07-01 op #include <stdlib.h>
34 8951cb19 2022-07-01 op #include <string.h>
37 8951cb19 2022-07-01 op vwarnx(const char *fmt, va_list ap)
39 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
40 8951cb19 2022-07-01 op if (fmt != NULL)
41 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
42 8951cb19 2022-07-01 op fprintf(stderr, "\n");
46 8951cb19 2022-07-01 op vwarnc(int code, const char *fmt, va_list ap)
48 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
49 8951cb19 2022-07-01 op if (fmt != NULL) {
50 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
51 8951cb19 2022-07-01 op fprintf(stderr, ": ");
53 8951cb19 2022-07-01 op fprintf(stderr, "%s\n", strerror(code));
57 8951cb19 2022-07-01 op vwarn(const char *fmt, va_list ap)
61 8951cb19 2022-07-01 op sverrno = errno;
62 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
63 8951cb19 2022-07-01 op if (fmt != NULL) {
64 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
65 8951cb19 2022-07-01 op fprintf(stderr, ": ");
67 8951cb19 2022-07-01 op fprintf(stderr, "%s\n", strerror(sverrno));
71 8951cb19 2022-07-01 op verrc(int eval, int code, const char *fmt, va_list ap)
73 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
74 8951cb19 2022-07-01 op if (fmt != NULL) {
75 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
76 8951cb19 2022-07-01 op fprintf(stderr, ": ");
78 8951cb19 2022-07-01 op fprintf(stderr, "%s\n", strerror(code));
83 8951cb19 2022-07-01 op verrx(int eval, const char *fmt, va_list ap)
85 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
86 8951cb19 2022-07-01 op if (fmt != NULL)
87 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
88 8951cb19 2022-07-01 op fprintf(stderr, "\n");
93 8951cb19 2022-07-01 op verr(int eval, const char *fmt, va_list ap)
97 8951cb19 2022-07-01 op sverrno = errno;
98 8951cb19 2022-07-01 op fprintf(stderr, "%s: ", getprogname());
99 8951cb19 2022-07-01 op if (fmt != NULL) {
100 8951cb19 2022-07-01 op vfprintf(stderr, fmt, ap);
101 8951cb19 2022-07-01 op fprintf(stderr, ": ");
103 8951cb19 2022-07-01 op fprintf(stderr, "%s\n", strerror(sverrno));
108 8951cb19 2022-07-01 op err(int eval, const char *fmt, ...)
112 8951cb19 2022-07-01 op va_start(ap, fmt);
113 8951cb19 2022-07-01 op verr(eval, fmt, ap);
118 8951cb19 2022-07-01 op errc(int eval, int code, const char *fmt, ...)
122 8951cb19 2022-07-01 op va_start(ap, fmt);
123 8951cb19 2022-07-01 op verrc(eval, code, fmt, ap);
128 8951cb19 2022-07-01 op errx(int eval, const char *fmt, ...)
132 8951cb19 2022-07-01 op va_start(ap, fmt);
133 8951cb19 2022-07-01 op verrx(eval, fmt, ap);
138 8951cb19 2022-07-01 op warn(const char *fmt, ...)
142 8951cb19 2022-07-01 op va_start(ap, fmt);
143 8951cb19 2022-07-01 op vwarn(fmt, ap);
148 8951cb19 2022-07-01 op warnc(int code, const char *fmt, ...)
152 8951cb19 2022-07-01 op va_start(ap, fmt);
153 8951cb19 2022-07-01 op vwarnc(code, fmt, ap);
158 8951cb19 2022-07-01 op warnx(const char *fmt, ...)
162 8951cb19 2022-07-01 op va_start(ap, fmt);
163 8951cb19 2022-07-01 op vwarnx(fmt, ap);