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
8 .\" # Phil Shafer, July 2014
14 .Nm xo_emit , xo_emit_h , xo_emit_hv
15 .Nd emit formatted output based on format string and arguments
21 .Fn xo_emit "const char *fmt" "..."
23 .Fn xo_emit_h "xo_handle_t *xop" "const char *fmt" "..."
25 .Fn xo_emit_hv "xo_handle_t *xop" "const char *fmt" "va_list vap"
29 function emits formatted output using the description in a format
30 string along with a set of zero or more arguments, in a style similar
33 but using a more complex format description string, as described in
37 uses the default output handle, as described in
41 uses an explicit handle.
45 for additional flexibility.
47 In this example, a set of four values is emitted using the following
49 .Bd -literal -offset indent
50 xo_emit(" {:lines/%7ju} {:words/%7ju} "
51 "{:characters/%7ju} {d:filename/%s}\n",
52 linect, wordct, charct, file);
54 Output can then be generated in various style, using
56 .Bd -literal -offset indent
59 % wc --libxo xml,pretty,warn /etc/motd
64 <characters>1140</characters>
65 <filename>/etc/motd</filename>
68 % wc --libxo json,pretty,warn /etc/motd
76 "filename": "/etc/motd"
81 % wc --libxo html,pretty,warn /etc/motd
83 <div class="text"> </div>
84 <div class="data" data-tag="lines"> 25</div>
85 <div class="text"> </div>
86 <div class="data" data-tag="words"> 165</div>
87 <div class="text"> </div>
88 <div class="data" data-tag="characters"> 1140</div>
89 <div class="text"> </div>
90 <div class="data" data-tag="filename">/etc/motd</div>
95 returns a negative value on error. If the
97 flag has been turned on for the specific handle using
99 then the number of display columns consumed by the output will be returned.
101 .Xr xo_open_container 3 ,