ifx_gl_mbsspn - get length of multi-byte sub-string

SYNOPSIS

#include <ifxgls.h>
int ifx_gl_mbsspn(gl_mchar_t *mbs1, int mbs1_byte_length,
		  gl_mchar_t *mbs2, int mbs2_byte_length)

DESCRIPTION

This function returns the number of characters in the maximum initial sub-string of mbs1 which consist entirely of multi-byte characters in the string mbs2.

If mbs1_byte_length is the value IFX_GL_NULL then the function will assume that mbs1 is a null-terminated string; otherwise the function assumes that mbs1_byte_length is the number of bytes in mbs1. If mbs2_byte_length is the value IFX_GL_NULL then the function will assume that mbs2 is a null-terminated string; otherwise the function assumes that mbs2_byte_length is the number of bytes in mbs2. See Multi-Byte Character String Termination for more general information about these lengths.

RETURN VALUES

This function returns the number of characters in the maximum initial sub-string of mbs1 which consist entirely of multi-byte characters in the string mbs2.

ERRORS

If an error has occurred, this function returns -1 and sets ifx_gl_lc_errno() to one of the following,
[IFX_GL_PARAMERR]
Either mbs1_byte_length is not equal to IFX_GL_NULL and is not greater than or equal to zero, or mbs2_byte_length is not equal to IFX_GL_NULL and is not greater than or equal to zero.
[IFX_GL_TERMMISMAT]
Either mbs1_byte_length is equal to IFX_GL_NULL and mbs2_byte_length is greater than or equal to zero or mbs1_byte_length is greater than or equal to zero and mbs2_byte_length is equal to IFX_GL_NULL
[IFX_GL_EILSEQ]
Either mbs1 or mbs2 contains an invalid multi-byte character
[IFX_GL_EINVAL]
Either the function cannot determine whether the last character of mbs1 is a valid multi-byte character, because it would need to read more than mbs1_byte_length bytes from mbs1, or the function cannot determine whether the last character of mbs2 is a valid multi-byte character, because it would need to read more than mbs2_byte_length bytes from mbs2. See Keeping Multi-Byte Strings Consistent for more information about this error.

SEE ALSO

ifx_gl_mbsspn() ifx_gl_wcsspn() ifx_gl_wcscspn()

ACKNOWLEDGEMENT

Portions of this description were derived from the X/Open CAE Specification: "System Interfaces and Headers, Issue 4"; X/Open Document Number: C202; ISBN: 1-872630-47-2; Published by X/Open Company Ltd., U.K.