summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/err.3
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-04-13 18:04:11 +0000
committerwollman <wollman@FreeBSD.org>1995-04-13 18:04:11 +0000
commitddebc4599e2be894d8a68c955ffc9e3e0d232e24 (patch)
treefbf6927f1eb28df85e2a0dd7f66f9d426763b114 /lib/libc/gen/err.3
parent234ee48c9e8ebbf0d2db32614b86983704b71010 (diff)
downloadFreeBSD-src-ddebc4599e2be894d8a68c955ffc9e3e0d232e24.zip
FreeBSD-src-ddebc4599e2be894d8a68c955ffc9e3e0d232e24.tar.gz
Add err_set_file() and err_set_exit() functions to make it possible for
programs which use err(3) to work nicely in a wider range of environments (e.g., dialog).
Diffstat (limited to 'lib/libc/gen/err.3')
-rw-r--r--lib/libc/gen/err.324
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/libc/gen/err.3 b/lib/libc/gen/err.3
index 2a3f4c3..a80edeb 100644
--- a/lib/libc/gen/err.3
+++ b/lib/libc/gen/err.3
@@ -29,9 +29,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)err.3 8.1 (Berkeley) 6/9/93
+.\" From: @(#)err.3 8.1 (Berkeley) 6/9/93
+.\" $Id$
.\"
-.Dd "June 9, 1993"
+.Dd April 13, 1995
.Dt ERR 3
.Os BSD 4
.Sh NAME
@@ -42,7 +43,9 @@
.Nm warn ,
.Nm vwarn ,
.Nm warnx ,
-.Nm vwarnx
+.Nm vwarnx ,
+.Nm err_set_file ,
+.Nm err_set_exit
.Nd formatted error messages
.Sh SYNOPSIS
.Fd #include <err.h>
@@ -62,13 +65,19 @@
.Fn warnx "const char *fmt" "..."
.Ft void
.Fn vwarnx "const char *fmt" "va_list args"
+.Ft void
+.Fn err_set_file "void *fp"
+.Ft void
+.Fn err_set_exit "void (*exitf)(int)"
.Sh DESCRIPTION
The
.Fn err
and
.Fn warn
family of functions display a formatted error message on the standard
-error output.
+error output, or on another file specified using the
+.Fn err_set_file
+function.
In all cases, the last component of the program name, a colon character,
and a space are output.
If the
@@ -95,6 +104,13 @@ and
.Fn verrx
functions do not return, but exit with the value of the argument
.Fa eval .
+The
+.Fn err_set_exit
+function can be used to specify a function which is called before
+.Xr exit 2
+to perform any necessary cleanup; passing a null function pointer for
+.Va exitf
+resets the hook to do nothing.
.Sh EXAMPLES
Display the current errno information string and exit:
.Bd -literal -offset indent
OpenPOWER on IntegriCloud