]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/err.3
ld.so.8: srcfix
[thirdparty/man-pages.git] / man3 / err.3
index f32a3ad0e22faac96a19cf5615600035b6d315ac..d163b64920fabc0e11b32a8f57a820310c91a20e 100644 (file)
@@ -1,6 +1,7 @@
 .\" Copyright (c) 1993
 .\"    The Regents of the University of California.  All rights reserved.
 .\"
+.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
+.\" %%%LICENSE_END
 .\"
 .\"    From: @(#)err.3 8.1 (Berkeley) 6/9/93
 .\" $FreeBSD: src/lib/libc/gen/err.3,v 1.11.2.5 2001/08/17 15:42:32 ru Exp $
 .\"
-.Dd March 6, 1999
-.Dt ERR 3
-.Os
-.Sh NAME
-.Nm err ,
-.Nm verr ,
-.Nm errx ,
-.Nm verrx ,
-.Nm warn ,
-.Nm vwarn ,
-.Nm warnx ,
-.Nm vwarnx ,
-.Nd formatted error messages
-.Sh SYNOPSIS
-.Fd #include <err.h>
-.Ft void
-.Fn err "int eval" "const char *fmt" "..."
-.Ft void
-.Fn errx "int eval" "const char *fmt" "..."
-.Ft void
-.Fn warn "const char *fmt" "..."
-.Ft void
-.Fn warnx "const char *fmt" "..."
-.Fd #include <stdarg.h>
-.Ft void
-.Fn verr "int eval" "const char *fmt" "va_list args"
-.Ft void
-.Fn verrx "int eval" "const char *fmt" "va_list args"
-.Ft void
-.Fn vwarn "const char *fmt" "va_list args"
-.Ft void
-.Fn vwarnx "const char *fmt" "va_list args"
-.Sh DESCRIPTION
+.\" 2011-09-10, mtk, Converted from mdoc to man macros
+.\"
+.TH ERR 3 2017-09-15 "Linux" "Linux Programmer's Manual"
+.SH NAME
+err, verr, errx, verrx, warn, vwarn, warnx, vwarnx \- formatted error messages
+.SH SYNOPSIS
+.nf
+.B #include <err.h>
+.PP
+.BI "void err(int " eval ", const char *" fmt ", ...);"
+.PP
+.BI "void errx(int " eval ", const char *" fmt ", ...);"
+.PP
+.BI "void warn(const char *" fmt ", ...);"
+.PP
+.BI "void warnx(const char *" fmt ", ...);"
+
+.B #include <stdarg.h>
+.PP
+.BI "void verr(int " eval ", const char *" fmt ", va_list " args );
+.PP
+.BI "void verrx(int " eval ", const char *" fmt ", va_list " args );
+.PP
+.BI "void vwarn(const char *" fmt ", va_list " args );
+.PP
+.BI "void vwarnx(const char *" fmt ", va_list " args );
+.fi
+.SH DESCRIPTION
 The
-.Fn err
+.BR err ()
 and
-.Fn warn
+.BR warn ()
 family of functions display a formatted error message on the standard
 error output.
 In all cases, the last component of the program name, a colon character,
 and a space are output.
 If the
-.Fa fmt
+.I fmt
 argument is not NULL, the
-.Xr printf 3
--like formatted error message is output.
+.BR printf (3)-like
+formatted error message is output.
 The output is terminated by a newline character.
-.Pp
+.PP
 The
-.Fn err ,
-.Fn verr ,
-.Fn warn ,
+.BR err (),
+.BR verr (),
+.BR warn (),
 and
-.Fn vwarn 
+.BR vwarn ()
 functions append an error message obtained from
-.Xr strerror 3
-based on a code or the global variable
-.Va errno ,
+.BR strerror (3)
+based on the global variable
+.IR errno ,
 preceded by another colon and space unless the
-.Fa fmt
+.I fmt
 argument is
-.Dv NULL .
-.Pp
-The
-.Fn err ,
-.Fn verr ,
-.Fn warn ,
-and
-.Fn vwarn
-functions use the global variable
-.Va errno
-to look up the error message.
-.Pp
+NULL.
+.PP
 The
-.Fn errx
+.BR errx ()
 and
-.Fn warnx
+.BR warnx ()
 functions do not append an error message.
-.Pp
+.PP
 The
-.Fn err ,
-.Fn verr ,
-.Fn errx ,
+.BR err (),
+.BR verr (),
+.BR errx (),
 and
-.Fn verrx
+.BR verrx ()
 functions do not return, but exit with the value of the argument
-.Fa eval .
-.Sh EXAMPLES
-Display the current errno information string and exit:
-.Bd -literal -offset indent
-if ((p = malloc(size)) == NULL)
-       err(1, NULL);
-if ((fd = open(file_name, O_RDONLY, 0)) == -1)
-       err(1, "%s", file_name);
-.Ed
-.Pp
+.IR eval .
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbw17 lb lb
+l l l.
+Interface      Attribute       Value
+T{
+.BR err (),
+.BR errx (),
+.br
+.BR warn (),
+.BR warnx (),
+.br
+.BR verr (),
+.BR verrx (),
+.br
+.BR vwarn (),
+.BR vwarnx ()
+T}     Thread safety   MT-Safe locale
+.TE
+.sp 1
+.SH CONFORMING TO
+These functions are nonstandard BSD extensions.
+.\" .SH HISTORY
+.\" The
+.\" .BR err ()
+.\" and
+.\" .BR warn ()
+.\" functions first appeared in
+.\" 4.4BSD.
+.SH EXAMPLE
+Display the current
+.I errno
+information string and exit:
+.PP
+.in +4n
+.EX
+p = malloc(size);
+if (p == NULL)
+    err(1, NULL);
+fd = open(file_name, O_RDONLY, 0);
+if (fd == \-1)
+    err(1, "%s", file_name);
+.EE
+.in
+.PP
 Display an error message and exit:
-.Bd -literal -offset indent
+.PP
+.in +4n
+.EX
 if (tm.tm_hour < START_TIME)
-       errx(1, "too early, wait until %s", start_time_string);
-.Ed
-.Pp
+    errx(1, "too early, wait until %s", start_time_string);
+.EE
+.in
+.PP
 Warn of an error:
-.Bd -literal -offset indent
-if ((fd = open(raw_device, O_RDONLY, 0)) == -1)
-       warnx("%s: %s: trying the block device",
-           raw_device, strerror(errno));
-if ((fd = open(block_device, O_RDONLY, 0)) == -1)
-       err(1, "%s", block_device);
-.Ed
-.Sh SEE ALSO
-.Xr exit 3 ,
-.Xr printf 3 ,
-.Xr perror 3 ,
-.Xr strerror 3
-.Sh HISTORY
-The
-.Fn err
-and
-.Fn warn
-functions first appeared in
-.Bx 4.4 .
+.PP
+.in +4n
+.EX
+fd = open(raw_device, O_RDONLY, 0);
+if (fd == \-1)
+    warnx("%s: %s: trying the block device",
+            raw_device, strerror(errno));
+fd = open(block_device, O_RDONLY, 0);
+if (fd == \-1)
+    err(1, "%s", block_device);
+.EE
+.in
+.SH SEE ALSO
+.BR error (3),
+.BR exit (3),
+.BR perror (3),
+.BR printf (3),
+.BR strerror (3)