---
name: "xo_clear_flags"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/xo_clear_flags"
---

# xo\_clear\_flags(3)

set operational flags for a libxo handle

## NAME

**xo\_set\_flags**, **xo\_clear\_flags** – set operational flags for a libxo handle

## LIBRARY

library “libxo”

## SYNOPSIS

**#include \<libxo/xo.h\>**

*void*\

**xo\_set\_flags**(*xo\_handle\_t \*handle*, *unsigned flags*);

*void*\

**xo\_clear\_flags**(*xo\_handle\_t \*handle*, *xo\_xof\_flags\_t flags*);

## DESCRIPTION

Use the **xo\_set\_flags**() function to set the flags for a **libxo** handle. To use the default handle, pass a NULL handle.

The set of valid flags include:

- **Flag Description**

  - XOF\_CLOSE\_FP

  Close file pointer on [xo\_destroy(3)](/xo_destroy/3.md). This flag will trigger the call of the **close\_func**() (provided via [xo\_set\_writer(3)](/xo_set_writer/3.md)) when the handle is destroyed.

- XOF\_COLOR

  Enable color and effects in output regardless of output device.

- XOF\_COLOR\_ALLOWED

  Allow color and effects if the output device is a terminal.

- XOF\_INFO

  Display info data attributes (HTML)

- XOF\_KEYS

  Emit the key attribute (XML)

- XOF\_LOG\_GETTEXT

  Log (via stderr) each [gettext(3)](/gettext/3.md) string lookup

- XOF\_LOG\_SYSLOG

  Log (via stderr) each syslog message (via [xo\_syslog(3)](/xo_syslog/3.md))

- XOF\_NO\_ENV

  Do not use the LIBXO\_OPTIONS environment variable.

- XOF\_PRETTY

  Make 'pretty printed' output, with the addition of indentation and newlines to enhance the readability of XML, JSON, and HTML output. Text output is not affected.

- XOF\_UNDERSCORES

  Replaces hyphens with underscores

- XOF\_UNITS

  Display units (XML and HMTL)

- XOF\_WARN

  Generate warnings for broken calls, triggering diagnostic output (on standard error) when the library notices errors during operations, or with arguments to functions. Without warnings enabled, such conditions are ignored. Warnings allow developers to debug their interaction with **libxo**. The function **xo\_failure**() can be used as a breakpoint for a debugger, regardless of whether warnings are enabled.

- XOF\_WARN\_XML

  Generate warnings in XML on stdout

- XOF\_XPATH

  Emit XPath expressions (HTML)

- XOF\_COLUMNS

  Force [xo\_emit(3)](/xo_emit/3.md) to return columns used

- XOF\_FLUSH

  Flush output after each [xo\_emit(3)](/xo_emit/3.md) call

If the style is XO\_STYLE\_HTML, the following additional flags can be used:

- **Flag Description**

  - XOF\_XPATH

  Emit "data-xpath" attributes

- XOF\_INFO

  Emit additional informational fields for HTML output. See [xo\_set\_info(3)](/xo_set_info/3.md) for details.

The XOF\_XPATH flag enables the emission of XPath expressions detailing the hierarchy of XML elements used to encode the data field, if the XPATH style of output were requested.

If the style is XO\_STYLE\_XML, the following additional flags can be used:

- **Flag Description**

  - XOF\_KEYS

  Add 'key' attribute to the XML encoding for field definitions that use the 'k' modifier. The key attribute has the value "key".

The **xo\_clear\_flags**() function turns off the given flags in a specific handle.

## SEE ALSO

[xo\_emit(3)](/xo_emit/3.md), [libxo(3)](/libxo/3.md)

## HISTORY

The **libxo** library first appeared in FreeBSD 11.0.

## AUTHORS

**libxo** was written by Phil Shafer ⟨*phil@freebsd.org*⟩.
