ifx_gl_mbsprev -- returns the previous multi-byte character

SYNOPSIS

#include <ifxgls.h>
gl_mchar_t *ifx_gl_mbsprev(gl_mchar_t *mb0, gl_mchar_t *mb)

DESCRIPTION

This function returns a pointer to the multi-byte character before mb, where mb0 is a pointer to the beginning of the multi-byte string.

RETURN VALUES

This function returns a pointer to the first byte of the multi-byte character before mb.

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 or a character between mb0 and mb is not a valid multi-byte character
[IFX_GL_EINVPTR]
mb is less than or equal to mb0
[IFX_GL_EINVAL]
The function cannot determine whether the character before mb is a valid multi-byte character, because it would need to read beyond mb. See Keeping Multi-Byte Strings Consistent for more information about this error.

APPLICATION USAGE

This function is typically used to transform the single-byte loop,
  sb = sb0 + strlen(sb0);
  for ( sb--; sb >= sb0; sb-- )
    /* Process single-byte character */
to the multi-byte loop,
  mb = mb0 + strlen(mb0);
  for ( mb = ifx_gl_mbsprev(mb0, mb) ; 
        mb >= mb0 ; 
        mb = ifx_gl_mbsprev(mb0, mb) )
    /* Process multi-byte character */

SEE ALSO

ifx_gl_mbsnext()

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.