xo_emit_warn(3)

xo_emit_warn3

Emit errors and warnings in multiple output styles

Part of xo_emit_err(3).

Usage

#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, ...);

Library

library “libxo”

Overview

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 provides compatible functions to allow this.

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.

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

Releases

25 releases since FreeBSD 11.0-RELEASE; the text changed 1 time.

  1. 11.0–11.1
  2. 11.2–16.0

History

The libxo library first appeared in FreeBSD 11.0.

Authors

libxo was written by Phil Shafer ⟨[email protected]⟩.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.