summaryrefslogtreecommitdiffstats
path: root/0.4.6/libxo/xo_create.3
blob: bfbadc4e6ed6af4cbc398ed3238656eef0668600 (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
.\" #
.\" # 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_create , xo_create_to_file , xo_destroy
.Nd create and destroy libxo output handles
.Sh LIBRARY
.Lb libxo
.Sh SYNOPSIS
.In libxo/xo.h
.Ft xo_handle_t *
.Fn xo_create "unsigned style" "unsigned flags"
.Ft xo_handle_t *
.Fn xo_create_to_file "FILE *fp" "unsigned style" "unsigned flags"
.Ft void
.Fn xo_destroy "xo_handle_t *handle"
.Sh DESCRIPTION
A
.Nm libxo
handle can be allocated using the
.Fn xo_create
function.
.Bd -literal -offset indent
  Example:
    xo_handle_t *xop = xo_create(XO_STYLE_JSON, XOF_WARN);
    ....
    xo_emit_h(xop, "testing\n");
.Ed
.Pp
By default,
.Nm libxo
writes output to standard output.
A convenience
function is provided for situations when output should be written to a
different file.
.Pp
Use the
.Dv XOF_CLOSE_FP
flag to trigger a call to
.Xr fclose 3
for the
.Dv FILE
pointer when the handle is destroyed.
.Pp
The
.Fn xo_destroy
function releases a handle and any resources it is
using.
Calling
.Fn xo_destroy
with a
.Dv NULL
handle will release any
resources associated with the default handle.
.Sh SEE ALSO
.Xr xo_emit 3 ,
.Xr xo_set_options 3 ,
.Xr libxo 3
OpenPOWER on IntegriCloud