xref: /freebsd/contrib/libxo/libxo/xo_set_writer.3 (revision 81ad6265)
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_writer
15.Nd set custom writer functions for a libxo handle
16.Sh LIBRARY
17.Lb libxo
18.Sh SYNOPSIS
19.In libxo/xo.h
20.Ft void
21.Sy typedef xo_ssize_t (*xo_write_func_t)(void *, const char *);
22.Pp
23.Sy typedef void (*xo_close_func_t)(void *);
24.Pp
25.Sy typedef int (*xo_flush_func_t)(void *);
26.Fn xo_set_writer "xo_handle_t *handle" "void *opaque"
27                        "xo_write_func_t write_func"
28                        "xo_close_func_t close_func"
29                        "xo_flush_func_t flush_func"
30.Sh DESCRIPTION
31The
32.Fn xo_set_writer
33function allows custom
34.Dq write
35functions
36which can tailor how
37.Nm libxo
38writes data.
39An
40.Fa opaque
41argument is
42recorded and passed back to the
43.Fa write_func
44function, allowing the function
45to acquire context information.
46The
47.Fa close_func
48function can
49release this opaque data and any other resources as needed.
50The
51.Fa flush_func
52function should
53flush any pending data associated with the opaque pointer.
54.Sh SEE ALSO
55.Xr xo_emit 3 ,
56.Xr libxo 3
57.Sh HISTORY
58The
59.Nm libxo
60library first appeared in
61.Fx 11.0 .
62.Sh AUTHORS
63.Nm libxo
64was written by
65.An Phil Shafer Aq Mt phil@freebsd.org .
66
67