1LIBXO(3) BSD Library Functions Manual LIBXO(3)
2
4 xo_attr, xo_attr_h, xo_attr_hv — Add attribute name/value pairs to for‐
5 matted output
6
8 library “libxo”
9
11 #include <libxo/xo.h>
12
13 xo_ssize_t
14 xo_attr(const char *name, const char *fmt, ...);
15
16 xo_ssize_t
17 xo_attr_h(xo_handle_t *handle, const char *name, const char *fmt, ...);
18
19 xo_ssize_t
20 xo_attr_hv(xo_handle_t *handle, const char *name, const char *fmt,
21 va_list vap);
22
24 The xo_attr() function emits attributes for the XML output style. The
25 attribute value is recorded in the handle and is attached to the next
26 field that is emitted via a xo_emit(3) call.
27
28 The name parameter give the name of the attribute to be encoded. The fmt
29 parameter gives a printf-style format string used to format the value of
30 the attribute using any remaining arguments, or the vap parameter as
31 passed to xo_attr_hv().
32
33 EXAMPLE:
34 xo_attr("seconds", "%ld", (unsigned long) login_time);
35 struct tm *tmp = localtime(login_time);
36 strftime(buf, sizeof(buf), "%R", tmp);
37 xo_emit("Logged in at {:login-time}\n", buf);
38 XML:
39 <login-time seconds="1408336270">00:14</login-time>
40
41 Since attributes are only emitted in XML, their use should be limited to
42 meta-data and additional or redundant representations of data already
43 emitted in other form.
44
46 xo_emit(3), libxo(3)
47
49 The libxo library first appeared in FreeBSD 11.0.
50
52 libxo was written by Phil Shafer <phil@freebsd.org>.
53
54
56 FreeBSD uses libxo version 1.6.0. Complete documentation can be found on
57 github:
58
59 https://juniper.github.io/libxo/1.6.0/html/index.html
60
61 libxo lives on github as:
62
63 https://github.com/Juniper/libxo
64
65 The latest release of libxo is available at:
66
67 https://github.com/Juniper/libxo/releases
68
70 The libxo library was added in FreeBSD 11.0.
71
73 Phil Shafer
74
75BSD July 21, 2022 BSD