nlsubstr(3X)
NAME
nlsubstr() − extract substring of a string using the MPE character set definition table
SYNOPSIS
#include <portnls.h>
void nlsubstr(
const char *instring,
short int inlength,
char *outstring,
short *poutlength,
short int start,
short int movelength,
short int langid,
short int flags,
unsigned short int err[2],
const unsigned short int *charset
);
DESCRIPTION
nlsubstr() extracts a substring from instring and places the result in outstring.
Arguments to nlsubstr() are used as follows:
instring The byte buffer from which the substring is extracted. The string can contain both one-byte and two-byte (Asian) characters.
inlength Length, in bytes, of instring
outstring Where the sub-string is placed.
poutlength Length, in bytes, of outstring. After a successful call, the variable to which poutlength points contains the actual length of the sub-string moved to outstring.
start The offset into instring where the sub-string starts. A value of zero is the beginning point.
movelength Length, in bytes, of the sub-string.
langid The ID number of the desired language.
flags This flag word is used primarily with Asian languages. It is meaningless with one-byte oriented languages. flags is used to indicate the treatment of the case when the first byte of the sub-string is the second byte of a two-byte Asian character and in the case where the last byte in the sub-string is the first byte of a two-byte Asian character.
Selection of nlsubstr()’s behavior if the first character is the second byte of an Asian character:
Value Description
F_RETURNERR Return an error condition.
F_SPP1 Start from start+1.
F_SPM1 Start from start−1.
F_SPBL Start from start, but replace the character with a blank in outstring.
F_SP Start from start, regardless of the value of the first character.
Selection of nlsubstr()’s behavior if the last character is the first byte of an Asian character:
Value Description
F_LMP1 Move until movelength+1 is reached.
F_LMM1 Move until movelength−1 is reached.
F_LMBL Move until movelength is reached, but replace the character with a blank in outstring.
F_LM Move until movelength is reached, regardless of the value of the last byte.
err The first element of this array contains the error number. The second element is always zero. If the call is successful, both elements contain zero.
Error # Meaning
2 Specified language is not configured.
7 Invalid inlength.
8 Invalid start.
9 Invalid movelength.
11 Invalid value in flags bits (8:4).
12 Invalid value for flags bits (12:4).
13 The start position is the second byte of an Asian character, or an underflow condition occurred because of flags.
14 The end position is the first byte of an Asian character, or an overflow condition occurred because of flags.
charset An array containing the character set definition for the language to be used, as returned by nlinfo(3X)’s itemnumber 12.
WARNINGS
This routine is provided for compatibility with MPE, a proprietary HP operating system. See portnls(5) for more information on the use of this routine. Use the Native Language Support routines for C programmers described by hpnls(5) for HP-UX NLS support.
AUTHOR
nlsubstr() was developed by HP.
SEE ALSO
EXTERNAL INFLUENCES
International Code Set Support
Single- and multi-byte character code sets are supported.
Hewlett-Packard Company — HP-UX Release 9.10: April 1995