| CTLSEQS_MATCH(3) | ctlseqs | CTLSEQS_MATCH(3) |
#include <ctlseqs.h>
ssize_t ctlseqs_match(
struct ctlseqs_matcher const *matcher,
char const *str,
size_t str_len,
union ctlseqs_value *result
);
For a NULL matcher, the function behaves as if a matcher configured with 0 npatterns is specified.
Argument result is the buffer where the function stores match results. If str contains a control sequence (or part of a control sequence), the length of the sequence is stored in buffer at offset 0, and the pointer to the starting ESC character at offset 1. Otherwise, buffer value at offset 0 and 1 is unspecified.
An extracted value can be either a string (not guaranteed to be NUL-terminated), or an unsigned integer, as in union ctlseqs_value:
union ctlseqs_value { char const *str; size_t len; unsigned long num; };
A group can contain one or multiple values, depending on different placeholders:
Otherwise, returns a negative value:
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty, provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.
| December 23, 2020 | 0.1.0 |