3 .\" The Regents of the University of California. All rights reserved.
5 .\" SPDX-License-Identifier: BSD-4-Clause-UC
7 .\" From: @(#)err.3 8.1 (Berkeley) 6/9/93
8 .\" $FreeBSD: src/lib/libc/gen/err.3,v 1.11.2.5 2001/08/17 15:42:32 ru Exp $
10 .\" 2011-09-10, mtk, Converted from mdoc to man macros
12 .TH err 3 (date) "Linux man-pages (unreleased)"
14 err, verr, errx, verrx, warn, vwarn, warnx, vwarnx \- formatted error messages
17 .RI ( libc ", " \-lc )
22 .BI "[[noreturn]] void err(int " eval ", const char *" fmt ", ...);"
23 .BI "[[noreturn]] void errx(int " eval ", const char *" fmt ", ...);"
25 .BI "void warn(const char *" fmt ", ...);"
26 .BI "void warnx(const char *" fmt ", ...);"
28 .B #include <stdarg.h>
30 .BI "[[noreturn]] void verr(int " eval ", const char *" fmt ", va_list " args );
31 .BI "[[noreturn]] void verrx(int " eval ", const char *" fmt ", va_list " args );
33 .BI "void vwarn(const char *" fmt ", va_list " args );
34 .BI "void vwarnx(const char *" fmt ", va_list " args );
41 family of functions display a formatted error message on the standard
43 In all cases, the last component of the program name, a colon character,
44 and a space are output.
47 argument is not NULL, the
49 formatted error message is output.
50 The output is terminated by a newline character.
58 functions append an error message obtained from
60 based on the global variable
62 preceded by another colon and space unless the
71 functions do not append an error message.
79 functions do not return, but exit with the value of the argument
82 For an explanation of the terms used in this section, see
90 Interface Attribute Value
100 T} Thread safety MT-Safe locale
106 These functions are nonstandard BSD extensions.
112 .\" functions first appeared in
117 information string and exit:
123 err(EXIT_FAILURE, NULL);
124 fd = open(file_name, O_RDONLY, 0);
126 err(EXIT_FAILURE, "%s", file_name);
130 Display an error message and exit:
134 if (tm.tm_hour < START_TIME)
135 errx(EXIT_FAILURE, "too early, wait until %s",
144 fd = open(raw_device, O_RDONLY, 0);
146 warnx("%s: %s: trying the block device",
147 raw_device, strerror(errno));
148 fd = open(block_device, O_RDONLY, 0);
150 err(EXIT_FAILURE, "%s", block_device);