155 lines
5.5 KiB
Plaintext
155 lines
5.5 KiB
Plaintext
'\"macro stdmacro
|
|
.if n .pH g3w.wstring @(#)wstring 41.4 of 5/26/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} wstring 3W "" "\&"
|
|
.if \nX=1 .ds x} wstring 3W ""
|
|
.if \nX=2 .ds x} wstring 3W "" "\&"
|
|
.if \nX=3 .ds x} wstring "" "" "\&"
|
|
.if \nX=9 .ds x} wstring 3W "SVR4 MNLS" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4wstring: wscat, wsncat, wscmp, wsncmp, wscpy, wsncpy, wslen, wschr,
|
|
wsrchr, wspbrk, wsspn, wscspn, wstok, wstostr, strtows\fP \- \f4wchar_t\fP
|
|
string operations and type transformation
|
|
.SH SYNOPSIS
|
|
.ft 4
|
|
#include <widec.h>
|
|
.sp .5
|
|
wchar_t \(**wscat(wchar_t \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^);
|
|
.sp .5
|
|
wchar_t \(**wsncat(wchar_t \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^, int \f2n\fP\^);
|
|
.sp .5
|
|
int wscmp(wchar_t \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^);
|
|
.sp .5
|
|
int wsncmp(wchar_t \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^, int \f2n\fP\^);
|
|
.sp .5
|
|
wchar_t \(**wscpy(wchar_t \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^);
|
|
.sp .5
|
|
wchar_t \(**wsncpy(wchar_t \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^, int \f2n\fP\^);
|
|
.sp .5
|
|
int wslen(wchar_t \(**\f2s\fP\^);
|
|
.sp .5
|
|
wchar_t \(**wschr(wchar_t \(**\f2s\fP\^, int \f2c\fP\^);
|
|
.sp .5
|
|
wchar_t \(**wsrchr(wchar_t \(**\f2s\fP\^, int \f2c\fP\^);
|
|
.sp .5
|
|
wchar_t \(**wspbrk(wchar_t \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^);
|
|
.sp .5
|
|
int wsspn(wchar_t \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^);
|
|
.sp .5
|
|
int wscspn(wchar_t \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^);
|
|
.sp .5
|
|
wchar_t \(**wstok(wchar_t \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^);
|
|
.sp .5
|
|
char \(**wstostr(char \(**\f2s1\fP\^, wchar_t \(**\f2s2\fP\^);
|
|
.sp .5
|
|
wchar_t \(**strtows(wchar_t \(**\f2s1\fP\^, char \(**\f2s2\fP\^);
|
|
.ft 1
|
|
.SH DESCRIPTION (International Functions)
|
|
The arguments \f2s1\fP, \f2s2\fP, and \f2s\fP
|
|
point to \f4wchar_t\fP strings (that is, arrays of
|
|
\f4wchar_t\fP characters terminated by a \f4wchar_t\fP null character).
|
|
The functions \f4wscat\fP, \f4wsncat\fP, \f4wscpy\fP,
|
|
and \f4wsncpy\f1 all modify \f2s1\fP.
|
|
These functions do not check for an overflow condition
|
|
of the array pointed to by \f2s1\fP.
|
|
.P
|
|
\f4wscat\fP appends a copy of the \f4wchar_t\fP string
|
|
\f2s2\fP to the end of the \f4wchar_t\fP string \f2s1\fP.
|
|
\f4wsncat\fP appends at most \f2n\fP \f4wchar_t\fP characters.
|
|
Each function returns \f2s1\fP.
|
|
.P
|
|
\f4wscmp\fP compares its arguments and returns an integer less than,
|
|
equal to, or greater than \f40\fP,
|
|
depending on whether \f2s1\fP is less than, equal
|
|
to, or greater than \f2s2\fP.
|
|
\f4wsncmp\fP makes the same comparison but
|
|
looks at most at \f2n\fP \f4wchar_t\fP characters.
|
|
.P
|
|
\f4wscpy\fP copies \f4wchar_t\fP string \f2s2\fP to \f2s1\fP,
|
|
stopping after the \f4wchar_t\fP
|
|
null character has been copied.
|
|
\f4wsncpy\fP copies exactly \f2n\fP \f4wchar_t\fP
|
|
characters, truncating \f2s2\fP or adding \f4wchar_t\fP
|
|
null characters to \f2s1\fP, if necessary.
|
|
The result will not be \f4wchar_t\fP null-terminated if
|
|
the length of \f2s2\fP is \f2n\fP or more.
|
|
Each function returns \f2s1\fP.
|
|
.P
|
|
\f4wslen\f1 returns the number of
|
|
\f4wchar_t\fP characters in \f2s\fP, not including
|
|
the terminating \f4wchar_t\fP null character.
|
|
.P
|
|
\f4wschr\fP and \f4wsrchr\fP
|
|
return a pointer to the first and last occurrence, respectively,
|
|
of \f4wchar_t\fP character \f2c\fP in \f4wchar_t\fP string \f2s\fP,
|
|
or a null pointer, if \f2c\fP does not occur in the string.
|
|
The \f4wchar_t\fP null character
|
|
terminating a string is considered to be part of the string.
|
|
.P
|
|
\f4wspbrk\fP returns a pointer to
|
|
the first occurrence in \f4wchar_t\fP
|
|
string \f2s1\fP of any \f4wchar_t\fP character
|
|
from \f4wchar_t\fP string \f2s2\fP, or a
|
|
null pointer if there is no \f4wchar_t\fP character
|
|
from \f2s2\fP in \f2s1\fP.
|
|
.P
|
|
\f4wsspn\fP
|
|
returns the length of the initial segment of
|
|
\f4wchar_t\fP string \f2s1\fP, which consists
|
|
entirely of \f4wchar_t\fP characters
|
|
from \f4wchar_t\fP string \f2s2\fP.
|
|
\f4wscspn\fP
|
|
returns the length of the initial segment of
|
|
\f4wchar_t\fP string \f2s1\fP, which does not consist
|
|
entirely of \f4wchar_t\fP characters
|
|
from \f4wchar_t\fP string \f2s2\fP.
|
|
.P
|
|
\f4wstok\f1 treats the \f4wchar_t\fP
|
|
string \f2s1\fP as a sequence of
|
|
zero or more text tokens,
|
|
separated by spans of one or more
|
|
\f4wchar_t\fP characters from the separator
|
|
\f4wchar_t\fP string \f2s2\fP.
|
|
The first call (with the pointer \f2s1\fP specified)
|
|
returns a pointer to the
|
|
first \f4wchar_t\fP character of the first token,
|
|
and writes a \f4wchar_t\fP null character into \f2s1\fP
|
|
immediately following the returned token.
|
|
The function keeps track of its position in the
|
|
\f4wchar_t\fP string between separate calls,
|
|
so that subsequent calls
|
|
(which must be made with the first argument a null pointer) will
|
|
progress through the \f4wchar_t\fP string \f2s1\fP immediately
|
|
following that token.
|
|
Similarly, subsequent calls will progress through the \f4wchar_t\fP
|
|
string \f2s1\fP until no tokens remain.
|
|
The \f4wchar_t\fP separator
|
|
string \f2s2\fP may be different from call to call.
|
|
A null pointer is returned
|
|
when no token remains in \f2s1\fP.
|
|
.P
|
|
\f4wstostr\f1 transforms \f4wchar_t\fP
|
|
characters in \f4wchar_t\fP string \f2s2\fP into
|
|
\s-1EUC\s+1, and transfers them to
|
|
character string \f2s1\fP, stopping
|
|
after the \f4wchar_t\fP null character has been processed.
|
|
.P
|
|
\f4strtows\f1 transforms \s-1EUC\s+1
|
|
in character string \f2s2\fP into \f4wchar_t\fP
|
|
characters, and transfers those to \f4wchar_t\fP string \f2s1\fP,
|
|
stopping after the null character has been processed.
|
|
.SH SEE ALSO
|
|
.na
|
|
\f4malloc\fP(3C),
|
|
\f4widec\fP(3W),
|
|
\f4malloc\fP(3X).
|
|
.ad
|
|
.SH DIAGNOSTICS
|
|
On success, \f4wstostr\fP and \f4strtows\fP
|
|
return \f2s1\fP.
|
|
If an illegal byte sequence is detected, a null pointer is
|
|
returned and \f4errno\fP is set to \f4\s-1EILSEQ\s+1\f1.
|