Welcome to little lamb

Code » limb » master » tree

[master] / src / doc / output.h / out.3.md

% limb manual
% out(3)
% limb 0.1.0
% 2023-07-24

# NAME

out, quiet, verb, err, errverb, sys, sysverb, add, adde, outdie, quietdie,
verbdie, errdie, errverbdie, sysdie, sysverbdie - write text to standard
output/error (and terminate process)

# SYNOPSIS

    #include <limb/output.h>

```pre hl
void quiet(...)
void out(...)
void verb(...)
void err(...)
void errverb(...)
void sys(...)
void sysverb(...)
void dbg(...)
void dbgverb(...)

void add(...)
void adde(...)

void quietdie(<em>exit</em>, ...)
void outdie(<em>exit</em>, ...)
void verbdie(<em>exit</em>, ...)
void errdie(<em>exit</em>, ...)
void errverbdie(<em>exit</em>, ...)
void sysdie(<em>exit</em>, ...)
void sysverbdie(<em>exit</em>, ...)
```

# DESCRIPTION

All of those are implemented as macros and will write to either standard output
or standard error, then maybe terminate the calling process or return.

<inc obuffers.md>

The macro `out`() writes given strings to *stdout* buffers with level
*OLVL_NORMAL* or more, adding a newline and flushing out the buffer.

The macros `quiet`() and `verb`() are similar to `out`(), only with *OLVL_QUIET*
and *OLVL_VERBOSE* levels respectively.

The macro `err`() writes given strings to *stderr* buffers with level
*OLVL_NORMAL* or more, adding a newline and flushing out the buffer.

The macro `errverb`() is similar only with *OLVL_VERSOSE* level.

The macro `add`() writes given strings to *stdout* buffers with *OLVL_NORMAL*.

The macro `adde`() writes given strings to *stderr* buffers with *OLVL_NORMAL*.

The macro `sys`() is similar to `err`() but will add a colon, a space and the
error description from [strerror](3) on `errno` after the given strings.

The macro `sysverb`() is similar only with *OLVL_VERSOSE* level.

The macro `dbg`() is similar to `out`() but with level *OLVL_DEBUG*, and
prefixing with function name, file name and line number (see [dbg_putmsg](3) for
more).

Macros `quietdie`(), `outdie`(), `verbdie`(), `errdie`(), `errverbdie`(),
`sysdie`() and `sysverbdie`() are similar to `quiet`(), `out`(), `verb`(),
`err`(), `errverb`(), `sys`() and `sysverb`() respectively but will terminate
the calling process (via [\_exit](3) using `exit` as status code).

## Escaping

It is possible to use *PUTMSG_ESC* (or simply *ESC*) as one of the strings in
order to toggle escaping. See to [buffer_putmsg](3) for more.

## Numbers

It is possible to add a numbers into a message, to have its value written into
the buffer into decimal form, through the use of macros :

: *PUTMSG_UINT(`n`)*
:: To have the value of unsigned number `n` written out

: *PUTMSG_INT(`n`)*
:: Same as *PUTMSG_UINT(`n`)* but for signed number

Refer to [buffer_putmsg](3) for more.

## Hexadecimal dump

It is possible to specify a byte-array whose content shall be written out as
hexadecimal dump, through the use of macro *PUTMSG_HEX* (or simply *HEX*),
taking two arguments : a pointer to the byte array, and its length.

For more, refer to [buffer_putmsg](3).

# SEE ALSO

[out_putmsg](3), [buffer_putmsg](3)