Guardian Native C Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

mbrlen(3) Guardian Native C Library Calls Reference Manual
NAME
mbrlen - Get the number of bytes in a character (restartable)
LIBRARY
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <wchar.h>
size_t mbrlen(
const char *s,
size_t n,
mbstate_t *ps
);
PARAMETERS
s Points to the character.
n The number of bytes to inspect.
ps Points to the mbstate_t object.
DESCRIPTION
If the s parameter is not a null pointer, the mbrlen() function inspects at most n bytes beginning
at the byte pointed to by s, and determines the number of bytes constituting the character ponted
to by s. Otherwise, the mbstate_t object pointed to by ps is used to completely describe the
current conversion state of the associated character sequence.
This function is equivalent to:
mbstate_t internal;
mbrtowc(NULL, s, n, ps !+ NULL ? ps : *internal);
where internal is the mbstat_t object for the mbrlen() function, except that the expression
designated by ps is evaluated only once.
RETURN VALUES
The mbrlen() function returns the first that applies of these:
0 (zero) If the next n or fewer bytes complete the character that corresponds to the null
wide-character.
positive If the next n or fewer bytes complete a valid character, the value returned is the
number of bytes that complete the character.
(size_t)-2 If the next n or fewer bytes contribute to an incomplete but potentially valid
character, and all n bytes have been processed (no value is stored).
(size_t)-1 If an encoding error orccurs, in which case the next n or fewer bytes do not con-
tribute to a complete and valid character. In this case, errno is set to [EILSEQ],
and the conversion state is undefined.
ERRORS
If any of these conditions occurs, errno is set to the corresponding value:
[EINVAL] The ps parmeter points to an object that contains an invalid conversion state.
486 Hewlett-Packard Company 527192-018