• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*-
2  * Copyright (c) 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the University nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  *
29  *	@(#)err.h	8.1 (Berkeley) 6/2/93
30  */
31 
32 #pragma once
33 
34 /**
35  * @file err.h
36  * @brief BSD error reporting functions. See `<error.h>` for the GNU equivalent.
37  */
38 
39 #include <stdarg.h>
40 #include <sys/cdefs.h>
41 #include <sys/types.h>
42 
43 __BEGIN_DECLS
44 
45 /**
46  * [err(3)](http://man7.org/linux/man-pages/man3/err.3.html) outputs the program name,
47  * the printf()-like formatted message, and the result of strerror() if `errno` is non-zero.
48  *
49  * Calls exit() with `__status`.
50  *
51  * New code should consider error() in `<error.h>`.
52  */
53 __noreturn void err(int __status, const char* __fmt, ...) __printflike(2, 3);
54 
55 /**
56  * [verr(3)](http://man7.org/linux/man-pages/man3/verr.3.html) outputs the program name,
57  * the vprintf()-like formatted message, and the result of strerror() if `errno` is non-zero.
58  *
59  * Calls exit() with `__status`.
60  *
61  * New code should consider error() in `<error.h>`.
62  */
63 __noreturn void verr(int __status, const char* __fmt, va_list __args) __printflike(2, 0);
64 
65 /**
66  * [errx(3)](http://man7.org/linux/man-pages/man3/errx.3.html) outputs the program name, and
67  * the printf()-like formatted message.
68  *
69  * Calls exit() with `__status`.
70  *
71  * New code should consider error() in `<error.h>`.
72  */
73 __noreturn void errx(int __status, const char* __fmt, ...) __printflike(2, 3);
74 
75 /**
76  * [verrx(3)](http://man7.org/linux/man-pages/man3/err.3.html) outputs the program name, and
77  * the vprintf()-like formatted message.
78  *
79  * Calls exit() with `__status`.
80  *
81  * New code should consider error() in `<error.h>`.
82  */
83 __noreturn void verrx(int __status, const char* __fmt, va_list __args) __printflike(2, 0);
84 
85 /**
86  * [warn(3)](http://man7.org/linux/man-pages/man3/warn.3.html) outputs the program name,
87  * the printf()-like formatted message, and the result of strerror() if `errno` is non-zero.
88  *
89  * New code should consider error() in `<error.h>`.
90  */
91 void warn(const char* __fmt, ...) __printflike(1, 2);
92 
93 /**
94  * [vwarn(3)](http://man7.org/linux/man-pages/man3/vwarn.3.html) outputs the program name,
95  * the vprintf()-like formatted message, and the result of strerror() if `errno` is non-zero.
96  *
97  * New code should consider error() in `<error.h>`.
98  */
99 void vwarn(const char* __fmt, va_list __args) __printflike(1, 0);
100 
101 /**
102  * [warnx(3)](http://man7.org/linux/man-pages/man3/warnx.3.html) outputs the program name, and
103  * the printf()-like formatted message.
104  *
105  * New code should consider error() in `<error.h>`.
106  */
107 void warnx(const char* __fmt, ...) __printflike(1, 2);
108 
109 /**
110  * [vwarnx(3)](http://man7.org/linux/man-pages/man3/warn.3.html) outputs the program name, and
111  * the vprintf()-like formatted message.
112  *
113  * New code should consider error() in `<error.h>`.
114  */
115 void vwarnx(const char* __fmt, va_list __args) __printflike(1, 0);
116 
117 __END_DECLS
118