Welcome to little lamb

Code » limb » master » tree

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

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

# NAME

list\_matches\_full, list\_matches - list all matching element from a partial
match in an array

# SYNOPSIS

    #include <limb/output.h>

```pre hl
typedef void (*obuffer_putmsgfn) (u8 level, const char * const *as, unsigned int n)

void list_matches_full(obuffer_putmsgfn <em>putmsg</em>, u8 <em>level</em>, const char *<em>intro</em>,
                       const char *<em>prefix</em>, const char *<em>sep</em>, const char *<em>outro</em>,
                       const char *<em>str</em>, size_t <em>slen</em>, int <em>first</em>,
                       const void *<em>list</em>, size_t <em>offset</em>, size_t <em>llen</em>)
void list_matches(obuffer_putmsgfn <em>putmsg</em>, u8 <em>level</em>, const char *<em>intro</em>,
                  const char *<em>prefix</em>, const char *<em>sep</em>, const char *<em>outro</em>,
                  const char *<em>str</em>, size_t <em>slen</em>, int <em>first</em>, const char **<em>list</em>)
```

# DESCRIPTION

The `list_matches_full`() function is aimed as a complement when using
[byte_get_match_full](3), in order to list all possible matches to the user.

It will use the function pointed by `putmsg` to write all possible matches to
`str` of length `slen` found inside the array `list` using a level of `level`.

First `intro` is written, then for each matching element first `prefix` then
the element itself. `sep` is written in between each elements, and finally
`outro` is written out with a newline, and the buffer is flushed.

Each element of the array `list` must by `llen` bytes long, and must contain,
at byte `offset` (starting from 0), a pointer to a NUL-terminated string to
check against.

The argument `first` must be the index of the first-matching element, as
set by [byte_get_match_full](3). At least one other element must be a match.


The `list_matches`() function is similar, but simply takes `list` as a NULL
terminated array of NUL-terminated string pointers.