Reference

xo_create(3)

create and destroy libxo output handles

NAME

xo_create, xo_create_to_file, xo_destroy – create and destroy libxo output handles

LIBRARY

library “libxo”

SYNOPSIS

#include <libxo/xo.h>

xo_handle_t *

xo_create(unsigned style, unsigned flags);

xo_handle_t *

xo_create_to_file(FILE *fp, unsigned style, unsigned flags);

void

xo_destroy(xo_handle_t *handle);

DESCRIPTION

A libxo handle can be allocated using the xo_create() function.

  Example:
    xo_handle_t *xop = xo_create(XO_STYLE_JSON, XOF_WARN);
    ....
    xo_emit_h(xop, "testing\n");

By default, libxo writes output to standard output. A convenience function is provided for situations when output should be written to a different file.

Use the XOF_CLOSE_FP flag to trigger a call to fclose(3) for the FILE pointer when the handle is destroyed.

The xo_destroy() function releases a handle and any resources it is using. Calling xo_destroy() with a NULL handle will release any resources associated with the default handle.

SEE ALSO

xo_emit(3), xo_set_options(3), libxo(3)

HISTORY

The libxo library first appeared in FreeBSD 11.0.

AUTHORS

libxo was written by Phil Shafer ⟨[email protected]⟩.

History