xref: /freebsd/contrib/libxo/libxo/xo_emit_err.3 (revision 42249ef2)
1.\" #
2.\" # Copyright (c) 2014, Juniper Networks, Inc.
3.\" # All rights reserved.
4.\" # This SOFTWARE is licensed under the LICENSE provided in the
5.\" # ../Copyright file. By downloading, installing, copying, or
6.\" # using the SOFTWARE, you agree to be bound by the terms of that
7.\" # LICENSE.
8.\" # Phil Shafer, July 2014
9.\"
10.Dd December 4, 2014
11.Dt LIBXO 3
12.Os
13.Sh NAME
14.Nm xo_emit_err , xo_emit_errc , xo_emit_errx
15.Nm xo_emit_warn , xo_emit_warnx , xo_emit_warn_c , xo_emit_warn_hc
16.Nd emit errors and warnings in multiple output styles
17.Sh LIBRARY
18.Lb libxo
19.Sh SYNOPSIS
20.In libxo/xo.h
21.Ft void
22.Fn xo_emit_warn "const char *fmt"  "..."
23.Ft void
24.Fn xo_emit_warnx "const char *fmt" "..."
25.Ft void
26.Fn xo_emit_warn_c "int code" "const char *fmt" "..."
27.Ft void
28.Fn xo_emit_warn_hc "xo_handle_t *xop" "int code, const char *fmt" "..."
29.Ft void
30.Fn xo_emit_err "int eval" "const char *fmt" "..."
31.Ft void
32.Fn xo_emit_errc "int eval" "int code" "const char *fmt" "..."
33.Ft void
34.Fn xo_emit_errx "int eval" "const char *fmt" "..."
35.Sh DESCRIPTION
36Many programs make use of the standard library functions
37.Xr err 3
38and
39.Xr warn 3
40to generate errors and warnings for the user.
41.Nm libxo
42wants to
43pass that information via the current output style, and provides
44compatible functions to allow this.
45.Pp
46The
47.Fa fmt
48argument is one compatible with
49.Xr xo_emit 3
50which allows these functions make structured data.
51To generate unstructured data,
52use the
53.Xr xo_err 3
54functions.
55.Pp
56These functions display the program name, a colon, a formatted message
57based on the arguments, and then optionally a colon and an error
58message associated with either
59.Fa errno
60or the
61.Fa code
62parameter.
63.Bd -literal -offset indent
64    EXAMPLE:
65        if (open(filename, O_RDONLY) < 0)
66            xo_err(1, "cannot open file '%s'", filename);
67.Ed
68.Sh SEE ALSO
69.Xr xo_emit 3 ,
70.Xr xo_format 5 ,
71.Xr xo_err 3 ,
72.Xr libxo 3
73.Sh HISTORY
74The
75.Nm libxo
76library first appeared in
77.Fx 11.0 .
78.Sh AUTHORS
79.Nm libxo
80was written by
81.An Phil Shafer Aq Mt phil@freebsd.org .
82
83