WSTRING(3W-SVR4) RISC/os Reference Manual WSTRING(3W-SVR4)
NAME
wstring: wscat, wsncat, wscmp, wsncmp, wscpy, wsncpy, wslen,
wschr, wsrchr, wspbrk, wsspn, wscspn, wstok, wstostr,
strtows - wchar_t string operations and type transfor-
mation
SYNOPSIS
#include <widec.h>
wchart *wscat(wchart *s1, wchart *s2);
wchart *wsncat(wchart *s1, wchart *s2, int n);
int wscmp(wchart *s1, wchart *s2);
int wsncmp(wchart *s1, wchart *s2, int n);
wchart *wscpy(wchart *s1, wchart *s2);
wchart *wsncpy(wchart *s1, wchart *2, int n);
int wslen(wchart *s);
wchart *wschr(wchart *s, int c);
wchart *wsrchr(wchart *s, int c);
wchart *wspbrk(wchart *s1, wchart *s2);
int wsspn(wchart *s1, wchart *s2);
int wscspn(wchart *s1, wchart *s2);
wchart *wstok(wchart *s1, wchart *s2);
char *wstostr(char *s1, wchart *s2);
wchart *strtows(wchart *s1, char *s2);
DESCRIPTION
The arguments s1, s2 and s point to wchar_t strings (that
is, arrays of wchar_t characters terminated by a wchar_t
null character). The functions wscat(), wsncat() wscpy()
and wsncpy() all modify s1. These functions do not check
for an overflow condition of the array pointed to by s1.
wscat() appends a copy of the wchar_t string s2 to the end
of the wchar_t string s1. wsncat() appends at most n
wchar_t characters. Each function returns s1.
wscmp() compares its arguments and returns an integer less
than, equal to, or greater than 0, depending on whether s1
is less than, equal to, or greater than s2. wsncmp() makes
the same comparison but looks at most n wchar_t characters.
wscpy() copies wchar_t string s2 to s1, stopping after the
wchar_t null character has been copied. wsncpy() copies
exactly n wchar_t characters, truncating s2 or adding
wchar_t null characters to s1, if necessary. The result
will not be wchar_t null-terminated if the length of s2 is n
Printed 11/19/92 Page 1
WSTRING(3W-SVR4) RISC/os Reference Manual WSTRING(3W-SVR4)
or more. Each function returns s1.
wslen() returns the number of wchar_t characters in s, not
including the terminating wchar_t null character.
wschr() [wsrchr()] returns a pointer to the first [last]
occurrence of wchar_t character c in wchar_t string s, or a
null pointer, if c does not occur in the string. The
wchar_t null character terminating a string is considered to
be part of the string.
wspbrk() returns a pointer to the first occurrence in
wchar_t string s1 of any wchar_t character from wchar_t
string s2, or a null pointer if there is no wchar_t charac-
ter from s2 in s1.
wsspn() [wscspn()] returns the length of the initial segment
of wchar_t string s1, which consists [does not consist]
entirely of wchar_t characters from wchar_t string s2.
wstok() considers the wchar_t string s1 to consist of a
sequence of zero or more text tokens, separated by spans of
one or more wchar_t characters from the separator wchar_t
string s2. The first call (with the pointer s1 specified)
returns a pointer to the first wchar_t character of the
first token, and writes a wchar_t null character into s1
immediately following the returned token. The function
keeps track of its position in the wchar_t string between
separate calls, so that subsequent calls (which must be made
with the first argument a null pointer) will progress
through the wchar_t string s1 immediately following that
token. Similarly, subsequent calls will progress through
the wchar_t string s1 until no tokens remain. The wchar_t
separator string s2 may be different from call to call. A
null pointer is returned when no token remains in s1.
wstostr() transforms wchar_t characters in wchar_t string s2
into EUC, and transfers them to character string s1, stop-
ping after the wchar_t null character has been processed.
strtows() transforms EUC in character string s2 into the
wchar_t characters, and transfers those to wchar_t string
s1, stopping after the null character has been processed.
DIAGNOSTICS
On success, wstostr() and strtows() return s1. If an ille-
gal byte sequence is detected, a null pointer is returned
and EILSEQ is set to errno.
SEE ALSO
malloc(3C), malloc(3X), widec(3W).
Page 2 Printed 11/19/92