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

mblen(3) Guardian Native C Library Calls Reference Manual
NAME
mblen - Determines the length in bytes of a multibyte character
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
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 <stdlib.h>
int mblen (
const char *mbs,
size_t n);
PARAMETERS
mbs Points to a multibyte character string.
n Species the maximum number of bytes to consider.
DESCRIPTION
The mblen() function determines the number of bytes in a multibyte character. The behavior of
the mblen() function is affected by the LC_CTYPE category of the current locale.
In locales with shift-state character encoding, a call to mblen() with a null pointer as the mbs
parameter, places the function in the initial shift state. A call to mblen() with an mbs parameter
that is not a null pointer, may change the shift state for subsequent calls to mblen() depending on
the character examined. Changing the LC_CTYPE category of the locale causes the shift state
of the function to be indeterminate. The implementation behaves as though no other function
calls the mblen() function.
RETURN VALUES
If the mbs parameter is not a null pointer, the mblen() function returns a value determined as fol-
lows:
If mbs points to a valid multibyte character other than the null character, mblen() returns
the number of bytes in the character unless the number of bytes is greater than n.
If mbs points to the null character, mblen() returns a value of 0 (zero).
If mbs does not point to a valid multibyte character or points to a character of more than
n bytes, mblen() returns a value of -1 and sets errno to indicate the error.
If the mbs parameter is a null pointer, the return value depends on whether the character encod-
ing in the current locale is shift-state dependent.
If the character encoding is shift-state dependent, mblen() returns a nonzero value.
If the character encoding is not shift-state dependent, mblen() returns a value of 0 (zero).
ERRORS
If the following condition occurs, the mblen() function sets errno to the corresponding value.
[EILSEQ] The mbs parameter points to an invalid multibyte character or the number of
bytes in the character is greater than the value of the n parameter.
484 Hewlett-Packard Company 527192-018