LIBXO(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

okay so bestie, you're reading LIBXO(3) from the Library Functions Manual, and it's literally giving β€œemit errors and warnings in multiple output styles.” no cap, that's the whole vibe. πŸ’…

✨ NAME ✨

The stars of this page are xo_emit_err, xo_emit_errc, xo_emit_errx, xo_emit_warn, xo_emit_warnx, xo_emit_warn_c, and xo_emit_warn_hc β€” and their whole thing is emitting errors and warnings in multiple output styles. periodt. πŸ’–

πŸ“š LIBRARY πŸ“š

the library is literally β€œlibxo”. 🫢

🧚 SYNOPSIS 🧚

#include <libxo/xo.h>

void
xo_emit_warn(const char *fmt, ...);

void
xo_emit_warnx(const char *fmt, ...);

void
xo_emit_warn_c(int code, const char *fmt, ...);

void
xo_emit_warn_hc(xo_handle_t *xop, int code, const char *fmt, ...);

void
xo_emit_err(int eval, const char *fmt, ...);

void
xo_emit_errc(int eval, int code, const char *fmt, ...);

void
xo_emit_errx(int eval, const char *fmt, ...);

πŸ’¬ DESCRIPTION πŸ’¬

Many programs make use of the standard library functions err(3) and warn(3) to generate errors and warnings for the user. libxo wants to pass that information via the current output style, and it provides compatible functions to allow this. slay. ✨

The fmt argument is one compatible with xo_emit(3) which allows these functions make structured data. To generate unstructured data, use the xo_err(3) functions. πŸ¦‹

These functions 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 errno or the code parameter. okay so that's the whole sentence but it's important: program name, colon, formatted message, optional colon, error message from errno or code. πŸ’€

🌟 EXAMPLE 🌟

if (open(filename, O_RDONLY) < 0)
    xo_err(1, "cannot open file '%s'", filename);

πŸ‘€ SEE ALSO πŸ‘€

Go look at these too, bestie: xo_emit(3), xo_format(5), xo_err(3), libxo(3). πŸŽ€

πŸ•°οΈ HISTORY πŸ•°οΈ

The libxo library first appeared in FreeBSD 11.0. iconic. πŸ‘‘

πŸ’œ AUTHORS πŸ’œ

libxo was written by Phil Shafer <phil@freebsd.org>. 🫢


and that's the whole page, bestie β€” this edition is from Debian, dated December 4, 2014, and it's LIBXO(3) all the way down. πŸ’…βœ¨

πŸ“¦ where this page comes from