LIBXO(3)
β¨ LIBXO(3) β¨
okay bestie, this one's from the Library Functions Manual and it's literally about making your errors and warnings not be boring. we're talking π xo_err, xo_errc, xo_errx, xo_warn, xo_warnx, xo_warn_c, and xo_warn_hc β the whole friend group π
πΈ NAME πΈ
xo_err, xo_errc, xo_errx, xo_warn, xo_warnx, xo_warn_c, xo_warn_hc β emit errors and warnings in multiple output styles π«Ά
π LIBRARY π
library βlibxoβ
π 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 π
so like, so many programs out here are using the standard library besties err(3) and warn(3) to throw errors and warnings at the user. totally valid. but libxo said "not me ignoring the current output style" π€ β it wants to pass all that info through the current output style, and it hands you compatible functions so you can do exactly that. iconic behavior, honestly.
the fmt argument is one that plays nice with printf(3) rather than xo_emit(3), and that's on purpose β it makes simple conversion β¨ effortless β¨. but lowkey important: this means these functions make unstructured data. if you want structured data, you gotta go use the xo_emit_err(3) functions instead. different vibe, different function, no cap.
so what do these do when you call them? they display:
- the program name
- a colon
- a formatted message based on the arguments
- and then optionally a colon and an error message associated with either
errnoor thecodeparameter π¦
EXAMPLE:
if (open(filename, O_RDONLY) < 0)
xo_err(1, "cannot open file '%s'", filename);
π SEE ALSO π
xo_emit(3), xo_emit_err(3), libxo(3)
π°οΈ HISTORY π°οΈ
the libxo library first appeared in FreeBSD 11.0. a whole era, fr fr π
π AUTHORS π
libxo was written by Phil Shafer <phil@freebsd.org>. we stan π«Ά
π ADDITIONAL DOCUMENTATION π
FreeBSD uses libxo version 1.7.5. the complete documentation can be found on github, bestie:
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's listed twice, and yes, it's still true both times πβ¨
βοΈ AUTHOR βοΈ
Phil Shafer
and that's the whole page, bestie! this one came from Debian, dated December 4, 2014, and it's filed under LIBXO(3) in the manual. go forth and make your errors pretty πππ¦
π¦ 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