NAME
buffer_putescall, buffer_putesc, buffer_putescs - write escaped text to a buffer
SYNOPSIS
#include <limb/buffer.h>
int buffer_putescall(buffer *b, const char *s, size_t len, size_t *w, size_t *r) ssize_t buffer_putesc(buffer *b, const char *s, size_t len) ssize_t buffer_putescs(buffer *b, const char *s)
DESCRIPTION
The buffer_putescall
() function will write the content of s
of length len
starting at position pointed by r
(usually 0) into buffer b
, whilst
taking care of escaping characters as needed. This means more characters might
be written into b
than present in s
.
The value pointed by r
will be updated to reflect the position inside
s
afterwards, while the value pointed by w
will be updated with the length
actually written into the buffer.
The buffer_putesc
() function does the same always processing s
from the
start.
The buffer_putescs
() function does the same as buffer_putesc
() but expects
s
to be a NUL-terminated string.
For more about the escaping performed, refer to esc_fmt(3).
RETURN VALUE
The buffer_putescall
() function returns 1 on success, otherwise it returns 0
and sets errno
to indicate the error.
The buffer_putesc
() and buffer_putescs
() functions return the number of
bytes written into buf
on success. Otherwise they returns -1 and sets errno
to indicate the error.
ERRORS
The buffer_putescall
() function may fail if :
EINVAL
r
was too high (i.e. more than len
).
All of these may also fail and set errno
for any of the errors specified for
buffer_flush(3).
NOTES
The behavior of these functions depend on the LC_CTYPE category of the current locale.