2021-11-11 07:24:50 +00:00
|
|
|
.TH CTLSEQS_READER_CONFIG 3 "Sep 01, 2020" 0.1.0 ctlseqs
|
2020-11-17 06:24:43 +00:00
|
|
|
.
|
|
|
|
.SH NAME
|
2020-12-11 04:47:14 +00:00
|
|
|
ctlseqs_reader_config - configure control sequence reader
|
2020-11-17 06:24:43 +00:00
|
|
|
.
|
|
|
|
.SH SYNOPSYS
|
|
|
|
.nf
|
|
|
|
.B #include <ctlseqs.h>
|
|
|
|
.PP
|
2021-11-11 07:24:50 +00:00
|
|
|
.B int ctlseqs_reader_config(
|
|
|
|
.BI " struct ctlseqs_reader *" reader ,
|
|
|
|
.BI " struct ctlseqs_reader_options const *" options
|
|
|
|
.B );
|
2020-11-17 06:24:43 +00:00
|
|
|
.fi
|
|
|
|
.
|
|
|
|
.SH DESCRIPTION
|
2020-12-14 13:12:09 +00:00
|
|
|
Changes the properties of the given
|
2020-11-17 06:24:43 +00:00
|
|
|
.IR reader .
|
|
|
|
.PP
|
|
|
|
The
|
|
|
|
.I options
|
|
|
|
argument is a pointer to a
|
2020-12-11 04:47:14 +00:00
|
|
|
.BR "struct ctlseqs_reader_options" ,
|
2020-11-17 06:24:43 +00:00
|
|
|
as shown below:
|
|
|
|
.PP
|
|
|
|
.nf
|
|
|
|
.in +4n
|
|
|
|
.EX
|
2020-12-11 04:47:14 +00:00
|
|
|
struct ctlseqs_reader_options {
|
2020-12-24 10:21:03 +00:00
|
|
|
union ctlseqs_value *result;
|
2020-11-17 06:24:43 +00:00
|
|
|
size_t maxlen;
|
|
|
|
int fd;
|
|
|
|
unsigned flags;
|
|
|
|
};
|
|
|
|
.EE
|
|
|
|
.in
|
|
|
|
.fi
|
|
|
|
.PP
|
|
|
|
Field
|
2020-12-24 10:21:03 +00:00
|
|
|
.I result
|
2022-02-14 16:43:29 +00:00
|
|
|
is the pointer to the buffer where the values extracted from the matching
|
|
|
|
sequence of
|
2021-11-11 07:24:50 +00:00
|
|
|
.B ctlseqs_read
|
2020-11-17 06:24:43 +00:00
|
|
|
will be stored.
|
|
|
|
.PP
|
|
|
|
Field
|
|
|
|
.I maxlen
|
2022-02-14 16:43:29 +00:00
|
|
|
specifies the maximum possible length (in bytes) of control sequence to be
|
|
|
|
read.
|
2020-11-17 06:24:43 +00:00
|
|
|
.PP
|
|
|
|
Field
|
|
|
|
.I fd
|
|
|
|
is the file descriptor to read from.
|
|
|
|
.PP
|
|
|
|
Field
|
|
|
|
.I flags
|
|
|
|
is the bit mask of multiple boolean options.
|
2020-12-25 11:20:05 +00:00
|
|
|
.SS Supported flags
|
2020-11-17 06:24:43 +00:00
|
|
|
.TP
|
|
|
|
.B CTLSEQS_READER_NO_POLL
|
|
|
|
In a
|
2021-11-11 07:24:50 +00:00
|
|
|
.B ctlseqs_read
|
2020-11-17 06:24:43 +00:00
|
|
|
call, do not
|
2021-11-11 07:24:50 +00:00
|
|
|
.B poll
|
2020-11-17 06:24:43 +00:00
|
|
|
before
|
2021-11-11 07:24:50 +00:00
|
|
|
.BR read .
|
2020-11-17 06:24:43 +00:00
|
|
|
You may want this option enabled if
|
|
|
|
.I fd
|
2021-11-11 07:24:50 +00:00
|
|
|
is polled elsewhere (e.g. in an event loop).
|
2020-12-18 10:16:38 +00:00
|
|
|
.TP
|
|
|
|
.B CTLSEQS_READER_SAVE_MATCHED_SEQS
|
|
|
|
When a sequence is successfully matched against a pattern during
|
2021-11-11 07:24:50 +00:00
|
|
|
.BR ctlseqs_read ,
|
2020-12-25 11:20:05 +00:00
|
|
|
save the original sequence to
|
|
|
|
.I result
|
|
|
|
alongside the extracted values.
|
2020-11-17 06:24:43 +00:00
|
|
|
.
|
|
|
|
.SH RETURN VALUE
|
|
|
|
.TP
|
|
|
|
.B CTLSEQS_OK
|
|
|
|
Success.
|
|
|
|
.TP
|
|
|
|
.B CTLSEQS_NOMEM
|
|
|
|
Fails to allocate sufficient memory.
|
2020-12-08 09:19:02 +00:00
|
|
|
.TP
|
|
|
|
.B CTLSEQS_ERROR
|
|
|
|
Attempts to change
|
2020-11-17 06:24:43 +00:00
|
|
|
.I maxlen
|
2022-02-14 16:43:29 +00:00
|
|
|
value, but data in the internal read buffer will be lost due to truncation, if
|
|
|
|
done so.
|
2020-11-17 06:24:43 +00:00
|
|
|
.
|
|
|
|
.SH COPYRIGHT
|
2021-11-11 07:24:50 +00:00
|
|
|
Copyright (c) 2020,2021 CismonX <admin@cismon.net>
|
2020-11-17 06:24:43 +00:00
|
|
|
.PP
|
2022-02-14 16:43:29 +00:00
|
|
|
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.
|
2020-12-21 12:56:27 +00:00
|
|
|
.
|
|
|
|
.SH SEE ALSO
|
2020-12-25 11:20:05 +00:00
|
|
|
.BR ctlseqs_match (3),
|
2020-12-21 12:56:27 +00:00
|
|
|
.BR ctlseqs_read (3)
|