ifx_gl_mbschr - search for the first occurrence of a character in a string

SYNOPSIS

#include <ifxgls.h>
gl_mchar_t *ifx_gl_mbschr(gl_mchar_t *mbs, int mbs_byte_length, gl_mchar_t *mb, int mb_byte_limit)

DESCRIPTION

This function locates the first occurrence of mb in the multi-byte string mbs.

If mbs_byte_length is the value IFX_GL_NULL then the function will assume that mbs is a null-terminated string; otherwise the function assumes that mbs_byte_length is the number of bytes in the multi-byte character string. See Multi-Byte Character String Termination for more general information about mbs_byte_length.

If mb_byte_limit is IFX_GL_NO_LIMIT then this function will read as many bytes as necessary from mb to form a complete character; otherwise, it will not read more than mb_byte_limit bytes from mb when trying to form a complete character. See Multi-Byte Character Termination for more general information about mb_byte_limit.

RETURN VALUES

This function returns the pointer to the first occurrence of mb in mbs. If mb is not found in mbs, then this function returns NULL and sets ifx_gl_lc_errno() to zero.

ERRORS

If an error has occurred, this function returns NULL and sets ifx_gl_lc_errno() to one of the following,
[IFX_GL_EILSEQ]
mb is an invalid multi-byte character or mbs contains an invalid multi-byte character
[IFX_GL_EINVAL]
The function cannot determine whether mb is a valid multi-byte character, because it would need to read more than mb_byte_limit bytes from mb, or the function cannot determine whether the last character of mbs is a valid multi-byte character, because it would need to read more than mbs_byte_length bytes from mbs. If mb_byte_limit is less than or equal to zero, this function always gives this error. See Keeping Multi-Byte Strings Consistent for more information about this error.
[IFX_GL_PARAMERR]
mbs_byte_length is not equal to IFX_GL_NULL and is not greater than or equal to zero.

SEE ALSO

ifx_gl_mbsrchr(), ifx_gl_wcschr(), ifx_gl_wcsrchr(),

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.