6c5bdc21e1
Reviewed by: phil, sjg
75 lines
1.8 KiB
Groff
75 lines
1.8 KiB
Groff
.\" #
|
|
.\" # Copyright (c) 2014, Juniper Networks, Inc.
|
|
.\" # All rights reserved.
|
|
.\" # This SOFTWARE is licensed under the LICENSE provided in the
|
|
.\" # ../Copyright file. By downloading, installing, copying, or
|
|
.\" # using the SOFTWARE, you agree to be bound by the terms of that
|
|
.\" # LICENSE.
|
|
.\" # Phil Shafer, July 2014
|
|
.\"
|
|
.Dd December 4, 2014
|
|
.Dt LIBXO 3
|
|
.Os
|
|
.Sh NAME
|
|
.Nm xo_err , xo_errc , xo_errx
|
|
.Nm xo_warn , xo_warnx , xo_warn_c , xo_warn_hc
|
|
.Nd emit errors and warnings in multiple output styles
|
|
.Sh LIBRARY
|
|
.Lb libxo
|
|
.Sh SYNOPSIS
|
|
.In libxo/xo.h
|
|
.Ft void
|
|
.Fn xo_warn "const char *fmt" "..."
|
|
.Ft void
|
|
.Fn xo_warnx "const char *fmt" "..."
|
|
.Ft void
|
|
.Fn xo_warn_c "int code" "const char *fmt" "..."
|
|
.Ft void
|
|
.Fn xo_warn_hc "xo_handle_t *xop" "int code, const char *fmt" "..."
|
|
.Ft void
|
|
.Fn xo_err "int eval" "const char *fmt" "..."
|
|
.Ft void
|
|
.Fn xo_errc "int eval" "int code" "const char *fmt" "..."
|
|
.Ft void
|
|
.Fn xo_errx "int eval" "const char *fmt" "..."
|
|
.Sh DESCRIPTION
|
|
Many programs make use of the standard library functions
|
|
.Xr err 3
|
|
and
|
|
.Xr warn 3
|
|
to generate errors and warnings for the user.
|
|
.Nm libxo
|
|
wants to
|
|
pass that information via the current output style, and provides
|
|
compatible functions to allow this.
|
|
.Pp
|
|
The
|
|
.Fa fmt
|
|
argument is one compatible with
|
|
.Xr printf 3
|
|
rather than
|
|
.Xr xo_emit 3
|
|
to aid in simple conversion. This means
|
|
these functions make unstructured data.
|
|
To generate structured data,
|
|
use the
|
|
.Xr xo_emit_err 3
|
|
functions.
|
|
.Pp
|
|
These functions display the program name, a colon, a formatted message
|
|
based on the arguments, and then optionally a colon and an error
|
|
message associated with either
|
|
.Fa errno
|
|
or the
|
|
.Fa code
|
|
parameter.
|
|
.Bd -literal -offset indent
|
|
EXAMPLE:
|
|
if (open(filename, O_RDONLY) < 0)
|
|
xo_err(1, "cannot open file '%s'", filename);
|
|
.Ed
|
|
.Sh SEE ALSO
|
|
.Xr xo_emit 3 ,
|
|
.Xr xo_emit_err 3 ,
|
|
.Xr libxo 3
|