LIBXO(3)
π LIBXO(3) π
okay bestie, welcome to the libxo(3) manual page β yes that's the library manual, and no we are not skipping anything, we're doing the whole thing π
β¨ NAME β¨
xo_create, xo_create_to_file, xo_destroy β create and destroy libxo output handles π
like... literally what it says. you make a handle, you unmake a handle. that's the whole arc.
πΈ LIBRARY πΈ
library βlibxoβ β that's the vibe, that's the whole vibe π¦
β¨ 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);
look at those signatures. gorgeous. no notes. π
π DESCRIPTION π
so a libxo handle can be allocated using the xo_create() function. that's the main character move, that's how you start everything.
Example:
xo_handle_t *xop = xo_create(XO_STYLE_JSON, XOF_WARN);
....
xo_emit_h(xop, "testing\n");
see how we did that? XO_STYLE_JSON and XOF_WARN and then boom, xo_emit_h with your handle. iconic behavior fr fr β¨
by default, libxo writes output to standard output. very demure, very mindful. but a convenience function is provided for situations when output should be written to a different file β that's your xo_create_to_file() bestie, in case you were wondering π«Ά
π heads up: use theXOF_CLOSE_FPflag to trigger a call tofclose(3)for theFILEpointer when the handle is destroyed. yes, for real, theFILEpointer gets closed. know that.
the xo_destroy() function releases a handle and any resources it is using. cleanup era π§Ή
and here's the plot twist: calling xo_destroy() with a NULL handle will release any resources associated with the default handle. so even the NULL one does something. not me being shocked π
π¦ SEE ALSO π¦
go read those too, iykyk π
π HISTORY π
the libxo library first appeared in FreeBSD 11.0. a classic. a legend. the origin story β
π AUTHORS π
libxo was written by Phil Shafer <phil@freebsd.org>. thank you for your service sir π«‘π
π ADDITIONAL DOCUMENTATION π
FreeBSD uses libxo version 1.7.5. complete documentation can be found on github:
https://juniper.github.io/libxo/1.7.5/html/index.html
libxo lives on github as:
https://github.com/Juniper/libxo
the latest release of libxo is available at:
https://github.com/Juniper/libxo/releases
three links, all of them important, all of them slaying π
πΈ HISTORY πΈ
(no because why are there two HISTORY sections, and yet β we keep them both, because the rules are the rules π)
the libxo library was added in FreeBSD 11.0. yeah. again. same energy. same fact. β¨
π AUTHOR π
Phil Shafer
and that's the whole page bestie!! this came to you from the Debian build, dated December 4, 2014, sitting pretty at LIBXO(3) β mwah, go create some handles ππβ¨
π¦ where this page comes from
- epel 9: libxo-devel 1.7.5-1.el9 Β· LicenseRef-Callaway-BSD
- fedora 43: libxo-devel 1.7.5-2.fc43 Β· LicenseRef-Callaway-BSD
- fedora 43: libxo-devel 1.7.5-2.fc43 Β· LicenseRef-Callaway-BSD
- fedora 44: libxo-devel 1.7.5-3.fc44 Β· LicenseRef-Callaway-BSD
- fedora 44: libxo-devel 1.7.5-3.fc44 Β· LicenseRef-Callaway-BSD
- nixpkgs unstable: libxo 1.7.5
- Copyright (c) 2014, Juniper Networks, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms