xref: /freebsd/contrib/libxo/libxo/xo_set_flags.3 (revision d6b92ffa)
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_set_flags , xo_clear_flags
15.Nd set operational flags for a libxo handle
16.Sh LIBRARY
17.Lb libxo
18.Sh SYNOPSIS
19.In libxo/xo.h
20.Ft void
21.Fn xo_set_flags "xo_handle_t *handle" "unsigned flags"
22.Ft void
23.Fn xo_clear_flags "xo_handle_t *handle" "xo_xof_flags_t flags"
24.Sh DESCRIPTION
25Use the
26.Fn xo_set_flags
27function to set the flags for a
28.Nm libxo
29handle.
30To use the default handle, pass a
31.Dv NULL
32handle.
33.Pp
34The set of valid flags include:
35.Bl -tag -width "XOF_UNDERSCORES"
36.It Sy "Flag            Description"
37.It Dv XOF_CLOSE_FP
38Close file pointer on
39.Xr xo_destroy 3 .
40This flag will trigger the call of the
41.Fn close_func
42(provided via
43.Xr xo_set_writer 3 )
44when the handle is destroyed.
45.It Dv XOF_COLOR
46Enable color and effects in output regardless of output device.
47.It Dv XOF_COLOR_ALLOWED
48Allow color and effects if the output device is a terminal.
49.It Dv XOF_INFO
50Display info data attributes (HTML)
51.It Dv XOF_KEYS
52Emit the key attribute (XML)
53.It Dv XOF_LOG_GETTEXT
54Log (via stderr) each
55.Xr gettext 3
56string lookup
57.It Dv XOF_LOG_SYSLOG
58Log (via stderr) each syslog message (via
59.Xr xo_syslog 3 )
60.It Dv XOF_NO_ENV
61Do not use the
62.Ev LIBXO_OPTIONS
63environment variable.
64.It Dv XOF_PRETTY
65Make 'pretty printed' output, with the
66addition of indentation and newlines to enhance the readability of
67XML, JSON, and HTML output.
68Text output is not affected.
69.It Dv XOF_UNDERSCORES
70Replaces hyphens with underscores
71.It Dv XOF_UNITS
72Display units (XML and HMTL)
73.It Dv XOF_WARN
74Generate warnings for broken calls, triggering diagnostic
75output (on standard error) when the library notices errors during
76operations, or with arguments to functions.
77Without warnings enabled, such conditions are ignored.
78Warnings allow developers to debug their interaction with
79.Nm libxo .
80The function
81.Fn xo_failure
82can be used as a breakpoint for a debugger,
83regardless of whether warnings are enabled.
84.It Dv XOF_WARN_XML
85Generate warnings in XML on stdout
86.It Dv XOF_XPATH
87Emit XPath expressions (HTML)
88.It Dv XOF_COLUMNS
89Force
90.Xr xo_emit 3
91to return columns used
92.It Dv XOF_FLUSH
93Flush output after each
94.Xr xo_emit 3
95call
96.El
97.Pp
98If the style is
99.Dv XO_STYLE_HTML ,
100the following additional flags can be
101used:
102.Bl -tag -width "XOF_UNDERSCORES"
103.It Sy "Flag            Description"
104.It Dv XOF_XPATH
105Emit "data-xpath" attributes
106.It Dv XOF_INFO
107Emit additional informational fields for HTML
108output.
109See
110.Xr xo_set_info 3
111for details.
112.El
113.Pp
114The
115.Dv XOF_XPATH
116flag enables the emission of XPath expressions detailing
117the hierarchy of XML elements used to encode the data field, if the
118XPATH style of output were requested.
119.Pp
120If the style is
121.Dv XO_STYLE_XML ,
122the following additional flags can be
123used:
124.Bl -tag -width "XOF_UNDERSCORES"
125.It Sy "Flag            Description"
126.It XOF_KEYS
127Add 'key' attribute to the XML encoding for
128field definitions that use the 'k' modifier.
129The key attribute has
130the value "key".
131.El
132.Pp
133The
134.Fn xo_clear_flags
135function turns off the given flags in a specific
136handle.
137.Sh SEE ALSO
138.Xr xo_emit 3 ,
139.Xr libxo 3
140