summaryrefslogtreecommitdiffstats
path: root/0.4.6/libxo/xo_emit_err.3
blob: bb1ca640c6e7f644ef1007fe4fc1d71046525a25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
.\" #
.\" # 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_emit_err , xo_emit_errc , xo_emit_errx
.Nm xo_emit_warn , xo_emit_warnx , xo_emit_warn_c , xo_emit_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_emit_warn "const char *fmt"  "..."
.Ft void
.Fn xo_emit_warnx "const char *fmt" "..."
.Ft void
.Fn xo_emit_warn_c "int code" "const char *fmt" "..."
.Ft void
.Fn xo_emit_warn_hc "xo_handle_t *xop" "int code, const char *fmt" "..."
.Ft void
.Fn xo_emit_err "int eval" "const char *fmt" "..."
.Ft void
.Fn xo_emit_errc "int eval" "int code" "const char *fmt" "..."
.Ft void
.Fn xo_emit_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 xo_emit 3
which allows these functions make structured data.
To generate unstructured data,
use the
.Xr xo_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_format 5 ,
.Xr xo_err 3 ,
.Xr libxo 3
OpenPOWER on IntegriCloud