limb 0.2.0

2024-01-09

list_matches_full(3)
limb manual
list_matches_full(3)

NAME

list_matches_full, list_matches - list all matching element from a partial match in an array

SYNOPSIS

#include <limb/output.h>
typedef void (*obuffer_putmsgfn) (u8 level, const char * const *as, unsigned int n)

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

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.

limb 0.1.0
2023-07-24
list_matches_full(3)