LIBXO(3)

πŸ“¦
version 1.7.5 Β· 2 versions
, in epel 9, fedora 43, fedora 44, nixpkgs unstable

✨ 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