LIBXO(3)
πΈ LIBXO(3) πΈ
okay bestie, welcome to the libxo manual page β library functions manual, if we're being formal π
β¨ NAME β¨
xo_err, xo_errc, xo_errx xo_warn, xo_warnx, xo_warn_c, xo_warn_hc β these bad boys emit errors and warnings in multiple output styles π
π LIBRARY π
the library is literally called "libxo" β that's the whole vibe π¦
β SYNOPSIS β
#include <libxo/xo.h>
void
xo_warn(const char *fmt, ...);
void
xo_warnx(const char *fmt, ...);
void
xo_warn_c(int code, const char *fmt, ...);
void
xo_warn_hc(xo_handle_t *xop, int code, const char *fmt, ...);
void
xo_err(int eval, const char *fmt, ...);
void
xo_errc(int eval, int code, const char *fmt, ...);
void
xo_errx(int eval, const char *fmt, ...);
π DESCRIPTION π
okay so picture this: so many programs out there are leaning on the standard library functions err(3) and warn(3) to spit out errors and warnings for the user. and libxo? it wants to pass all that info along via the current output style instead, so it gives you these compatible functions to make that happen. honestly, iconic behavior π
so the fmt argument β heads up, it's compatible with printf(3), not with xo_emit(3). the whole point is to make simple conversion easy peasy. which means... yeah, these functions make unstructured data π. if you want structured data, you're gonna wanna use the xo_emit_err(3) functions instead, no cap.
here's what these functions actually display, in order:
- the program name
- a colon
- a formatted message based on the arguments
- and then optionally a colon plus an error message associated with either
errnoor thecodeparameter
and here's the EXAMPLE: they gave us, chef's kiss:
if (open(filename, O_RDONLY) < 0)
xo_err(1, "cannot open file '%s'", filename);
π¦ SEE ALSO π¦
π HISTORY π
the libxo library first appeared in FreeBSD 11.0 β a whole era β
π AUTHORS π
libxo was written by Phil Shafer <phil@freebsd.org> β thank you for your service, king π«Ά
aaaand that's the page, bestie!! this one's from Debian, dated December 4, 2014, version LIBXO(3) β mwah, go forth and emit responsibly ππ§ββοΈ
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2014, Juniper Networks, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms