LIBXO(3)
β¨ LIBXO(3) β¨ β the libxo manual, but make it a group chat
okay bestie, so this is LIBXO(3), a Library Functions Manual page, and it's literally all about xo_attr, xo_attr_h, and xo_attr_hv β the little trio that adds attribute name/value pairs to your formatted output. no cap. π
π NAME π
xo_attr, xo_attr_h, xo_attr_hv β add attribute name/value pairs to formatted output β¨
π LIBRARY π
library βlibxoβ
πΈ SYNOPSIS πΈ
#include <libxo/xo.h>
xo_ssize_t
xo_attr(const char *name, const char *fmt, ...);
xo_ssize_t
xo_attr_h(xo_handle_t *handle, const char *name, const char *fmt, ...);
xo_ssize_t
xo_attr_hv(xo_handle_t *handle, const char *name, const char *fmt,
va_list vap);
π DESCRIPTION π
so here's the tea π« β xo_attr() emits attributes for the XML output style. that's its whole thing. the attribute value gets recorded in the handle, and then it's attached to the next field that gets emitted via a xo_emit(3) call. it's giving "sneak it in right before the main event" energy. π
the name parameter gives the name of the attribute to be encoded. and the fmt parameter gives a printf-style format string that's used to format the value of the attribute, using any remaining arguments β or the vap parameter as passed to xo_attr_hv(). iykyk. β¨
EXAMPLE:
xo_attr("seconds", "%ld", (unsigned long) login_time);
struct tm *tmp = localtime(login_time);
strftime(buf, sizeof(buf), "%R", tmp);
xo_emit("Logged in at {:login-time}\n", buf);
XML:
<login-time seconds="1408336270">00:14</login-time>
β οΈ okay important, bestie β since attributes are only emitted in XML, their use should be limited to meta-data and additional or redundant representations of data already emitted in other form. don't be out here main-character-ing your whole dataset into an attribute. π
π SEE ALSO π
π¦ HISTORY π¦
the libxo library first appeared in FreeBSD 11.0. iconic behavior honestly.
π«Ά AUTHORS π«Ά
libxo was written by Phil Shafer <phil@freebsd.org>. legend. π
π 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
β HISTORY β
the libxo library was added in FreeBSD 11.0. (yes it says history twice, no i'm not skipping it, we keep every single crumb π)
π AUTHOR π
Phil Shafer
and that's the whole page, babe. Debian, July 2014, LIBXO(3) β that's the version and date signing off at the bottom, and honestly? iconic. go emit some attributes. slay. π β¨π
π¦ 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