Print this page
Ensured various XPG7 stuff are declared properly in sys/stat.h (and cleanup)
New documentation for wcslen, wcsnlen, wcscasecmp (and friends), wcsdup.
Various other tweaks and markup improvements.
Various tweaks -- add our sections, etc.
Fixes for wcstok.
Finished obsoleting interfaces for XPG7.
*** 1,432 ****
! '\" te
.\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
.\" http://www.opengroup.org/bookstore/.
.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
.\" This notice shall appear on any product containing this material.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
! .TH WCSTRING 3C "Aug 14, 2002"
! .SH NAME
! wcstring, wcscat, wscat, wcsncat, wsncat, wcscmp, wscmp, wcsncmp, wsncmp,
! wcscpy, wscpy, wcsncpy, wsncpy, wcslen, wslen, wcschr, wschr, wcsrchr, wsrchr,
! windex, wrindex, wcspbrk, wspbrk, wcswcs, wcsspn, wsspn, wcscspn, wscspn,
! wcstok, wstok \- wide-character string operations
! .SH SYNOPSIS
! .LP
! .nf
! #include <wchar.h>
!
! \fBwchar_t *\fR\fBwcscat\fR(\fBwchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwcsncat\fR(\fBwchar_t *restrict\fR \fIws1\fR, \fBconst wchar_t *restrict\fR \fIws2\fR,
! \fBsize_t\fR \fIn\fR);
! .fi
!
! .LP
! .nf
! \fBint\fR \fBwcscmp\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBint\fR \fBwcsncmp\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR, \fBsize_t\fR \fIn\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwcscpy\fR(\fBwchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwcsncpy\fR(\fBwchar_t *restrict\fR \fIws1\fR, \fBconst wchar_t *restrict\fR \fIws2\fR,
! \fBsize_t\fR \fIn\fR);
! .fi
!
! .LP
! .nf
! \fBsize_t\fR \fBwcslen\fR(\fBconst wchar_t *\fR\fIws\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwcschr\fR(\fBconst wchar_t *\fR\fIws\fR, \fBwchar_t\fR \fIwc\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwcsrchr\fR(\fBconst wchar_t *\fR\fIws\fR, \fBwchar_t\fR \fIwc\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwcspbrk\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwcswcs\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBsize_t\fR \fBwcsspn\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBsize_t\fR \fBwcscspn\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .SS "XPG4, SUS, SUSv2, SUSv3"
! .LP
! .nf
! \fBwchar_t *\fR\fBwcstok\fR(\fBwchar_t *restrict\fR \fIws1\fR, \fBconst wchar_t *restrict\fR \fIws2\fR);
! .fi
!
! .SS "Default and other standards"
! .LP
! .nf
! \fBwchar_t *\fR\fBwcstok\fR(\fBwchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR, \fBwchar_t **\fR\fIptr\fR);
! .fi
!
! .LP
! .nf
! #include <widec.h>
!
! \fBwchar_t *\fR\fBwscat\fR(\fBwchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwsncat\fR(\fBwchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR, \fBsize_t\fR \fIn\fR);
! .fi
!
! .LP
! .nf
! \fBint\fR \fBwscmp\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBint\fR \fBwsncmp\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR, \fBsize_t\fR \fIn\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwscpy\fR(\fBwchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwsncpy\fR(\fBwchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR, \fBsize_t\fR \fIn\fR);
! .fi
!
! .LP
! .nf
! \fBsize_t\fR \fBwslen\fR(\fBconst wchar_t *\fR\fIws\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwschr\fR(\fBconst wchar_t *\fR\fIws\fR, \fBwchat_t\fR \fIwc\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwsrchr\fR(\fBconst wchar_t *\fR\fIws\fR, \fBwchat_t\fR \fIwc\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwspbrk\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBsize_t\fR \fBwsspn\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBsize_t\fR \fBwscspn\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwstok\fR(\fBwchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwindex\fR(\fBconst wchar_t *\fR\fIws\fR, \fBwchar_t\fR \fIwc\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *\fR\fBwrindex\fR(\fBconst wchar_t *\fR\fIws\fR, \fBwchar_t\fR \fIwc\fR);
! .fi
!
! .SS "ISO C++"
! .LP
! .nf
! #include <wchar.h>
!
! \fBconst wchar_t *\fR\fBwcschr\fR(\fBconst wchar_t *\fR\fIws\fR, \fBwchar_t\fR \fIwc\fR);
! .fi
!
! .LP
! .nf
! \fBconst wchar_t *\fR\fBwcspbrk\fR(\fBconst wchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBconst wchar_t *\fR\fBwcsrchr\fR(\fBconst wchar_t *\fR\fIws\fR, \fBwchar_t\fR \fIwc\fR);
! .fi
!
! .LP
! .nf
! #include <cwchar>
!
! \fBwchar_t *std::\fR\fBwcschr\fR(\fBwchar_t *\fR\fIws\fR, \fBwchar_t\fR \fIwc\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *std::\fR\fBwcspbrk\fR(\fBwchar_t *\fR\fIws1\fR, \fBconst wchar_t *\fR\fIws2\fR);
! .fi
!
! .LP
! .nf
! \fBwchar_t *std::\fR\fBwcsrchr\fR(\fBwchar_t *\fR\fIws\fR, \fBwchar_t\fR \fIwc\fR);
! .fi
!
! .SH DESCRIPTION
! .sp
! .LP
! These functions operate on wide-character strings terminated by \fBwchar_t\fR
! \fINULL\fR characters. During appending or copying, these routines do not check
! for an overflow condition of the receiving string. In the following, \fIws\fR,
! \fIws1\fR, and \fIws2\fR point to wide-character strings terminated by a
! \fBwchar_t NULL\fR.
! .SS "wcscat(\|), wscat(\|)"
! .sp
! .LP
! The \fBwcscat()\fR and \fBwscat()\fR functions append a copy of the
! wide-character string pointed to by \fIws2\fR (including the terminating null
wide-character code) to the end of the wide-character string pointed to by
! \fIws1\fR. The initial wide-character code of \fIws2\fR overwrites the null
! wide-character code at the end of \fIws1\fR. If copying takes place between
objects that overlap, the behavior is undefined. Both functions return
! \fIs1\fR; no return value is reserved to indicate an error.
! .SS "wcsncat(\|), wsncat(\|)"
! .sp
! .LP
! The \fBwcsncat()\fR and \fBwsncat()\fR functions append not more than \fIn\fR
wide-character codes (a null wide-character code and wide-character codes that
! follow it are not appended) from the array pointed to by \fIws2\fR to the end
! of the wide-character string pointed to by \fIws1\fR. The initial
! wide-character code of \fIws2\fR overwrites the null wide-character code at the
! end of \fIws1\fR. A terminating null wide-character code is always appended to
! the result. Both functions return \fIws1\fR; no return value is reserved to
! indicate an error.
! .SS "wcscmp(\|), wscmp(\|)"
! .sp
! .LP
! The \fBwcscmp()\fR and \fBwscmp()\fR functions compare the wide-character
! string pointed to by \fIws1\fR to the wide-character string pointed to by
! \fIws2\fR. The sign of a non-zero return value is determined by the sign of the
difference between the values of the first pair of wide-character codes that
differ in the objects being compared. Upon completion, both functions return an
integer greater than, equal to, or less than zero, if the wide-character string
! pointed to by \fIws1\fR is greater than, equal to, or less than the
! wide-character string pointed to by \fIws2\fR.
! .SS "wcsncmp(\|), wsncmp(\|)"
! .sp
! .LP
! The \fBwcsncmp()\fR and \fBwsncmp()\fR functions compare not more than \fIn\fR
wide-character codes (wide-character codes that follow a null wide character
! code are not compared) from the array pointed to by \fIws1\fR to the array
! pointed to by \fIws2\fR. The sign of a non-zero return value is determined by
the sign of the difference between the values of the first pair of
wide-character codes that differ in the objects being compared. Upon successful
completion, both functions return an integer greater than, equal to, or less
! than zero, if the possibly null-terminated array pointed to by \fIws1\fR is
greater than, equal to, or less than the possibly null-terminated array pointed
! to by \fIws2\fR.
! .SS "wcscpy(\|), wscpy(\|)"
! .sp
! .LP
! The \fBwcscpy()\fR and \fBwscpy()\fR functions copy the wide-character string
! pointed to by \fIws2\fR (including the terminating null wide-character code)
! into the array pointed to by \fIws1\fR. If copying takes place between objects
! that overlap, the behavior is undefined. Both functions return \fIws1\fR; no
! return value is reserved to indicate an error.
! .SS "wcsncpy(\|), wsncpy(\|)"
! .sp
! .LP
! The \fBwcsncpy()\fR and \fBwsncpy()\fR functions copy not more than \fIn\fR
wide-character codes (wide-character codes that follow a null wide character
! code are not copied) from the array pointed to by \fIws2\fR to the array
! pointed to by \fIws1\fR. If copying takes place between objects that overlap,
! the behavior is undefined. If the array pointed to by \fIws2\fR is a
! wide-character string that is shorter than \fIn\fR wide-character codes, null
wide-character codes are appended to the copy in the array pointed to by
! \fIws1\fR, until a total \fIn\fR wide-character codes are written. Both
! functions return \fI ws1\fR; no return value is reserved to indicate an error.
! .SS "wcslen(\|), wslen(\|)"
! .sp
! .LP
! The \fBwcslen()\fR and \fBwslen()\fR functions compute the number of
! wide-character codes in the wide-character string to which \fIws\fR points, not
! including the terminating null wide-character code. Both functions return
! \fIws\fR; no return value is reserved to indicate an error.
! .SS "wcschr(\|), wschr(\|)"
! .sp
! .LP
! The \fBwcschr()\fR and \fBwschr()\fR functions locate the first occurrence of
! \fIwc\fR in the wide-character string pointed to by \fIws\fR. The value of
! \fIwc\fR must be a character representable as a type \fBwchar_t\fR and must be
a wide-character code corresponding to a valid character in the current locale.
The terminating null wide-character code is considered to be part of the
wide-character string. Upon completion, both functions return a pointer to the
wide-character code, or a null pointer if the wide-character code is not found.
! .SS "wcsrchr(\|), wsrchr(\|)"
! .sp
! .LP
! The \fBwcsrchr()\fR and \fBwsrchr()\fR functions locate the last occurrence of
! \fIwc\fR in the wide-character string pointed to by \fIws\fR. The value of
! \fIwc\fR must be a character representable as a type \fBwchar_t\fR and must be
a wide-character code corresponding to a valid character in the current locale.
The terminating null wide-character code is considered to be part of the
wide-character string. Upon successful completion, both functions return a
! pointer to the wide-character code, or a null pointer if \fIwc\fR does not
! occur in the wide-character string.
! .SS "windex(\|), wrindex(\|)"
! .sp
! .LP
! The \fBwindex()\fR and \fBwrindex()\fR functions behave the same as
! \fBwschr()\fR and \fBwsrchr()\fR, respectively.
! .SS "wcspbrk(\|), wspbrk(\|)"
! .sp
! .LP
! The \fBwcspbrk()\fR and \fBwspbrk()\fR functions locate the first occurrence in
! the wide character string pointed to by \fIws1\fR of any wide-character code
! from the wide-character string pointed to by \fIws2\fR. Upon successful
completion, the function returns a pointer to the wide-character code, or a
! null pointer if no wide-character code from \fIws2\fR occurs in \fIws1\fR.
! .SS "wcswcs(\|)"
! .sp
! .LP
! The \fBwcswcs()\fR function locates the first occurrence in the wide-character
! string pointed to by \fIws1\fR of the sequence of wide-character codes
(excluding the terminating null wide-character code) in the wide-character
! string pointed to by \fIws2\fR. Upon successful completion, the function
returns a pointer to the located wide-character string, or a null pointer if
! the wide-character string is not found. If \fIws2\fR points to a wide-character
! string with zero length, the function returns \fIws1\fR.
! .SS "wcsspn(\|), wsspn(\|)"
! .sp
! .LP
! The \fBwcsspn()\fR and \fBwsspn()\fR functions compute the length of the
! maximum initial segment of the wide-character string pointed to by \fIws1\fR
which consists entirely of wide-character codes from the wide-character string
! pointed to by \fIws2\fR. Both functions return the length \fIws1\fR; no return
! value is reserved to indicate an error.
! .SS "wcscspn(\|), wscspn(\|)"
! .sp
! .LP
! The \fBwcscspn()\fR and \fBwscspn()\fR functions compute the length of the
! maximum initial segment of the wide-character string pointed to by \fIws1\fR
! which consists entirely of wide-character codes \fInot\fR from the
! wide-character string pointed to by \fIws2\fR. Both functions return the length
! of the initial substring of \fIws1\fR; no return value is reserved to indicate
! an error.
! .SS "wcstok(\|), wstok(\|)"
! .sp
! .LP
! A sequence of calls to the \fBwcstok()\fR and \fBwstok()\fR functions break the
! wide-character string pointed to by \fIws1\fR into a sequence of tokens, each
of which is delimited by a wide-character code from the wide-character string
! pointed to by \fIws2\fR.
! .SS "Default and other standards"
! .sp
! .LP
! The third argument points to a caller-provided \fBwchar_t\fR pointer into which
! the \fBwcstok()\fR function stores information necessary for it to continue
scanning the same wide-character string. This argument is not available with
! the XPG4 and SUS versions of \fBwcstok()\fR, nor is it available with the
! \fBwstok()\fR function. See \fBstandards\fR(5).
! .sp
! .LP
! The first call in the sequence has \fIws1\fR as its first argument, and is
followed by calls with a null pointer as their first argument. The separator
! string pointed to by \fIws2\fR may be different from call to call.
! .sp
! .LP
The first call in the sequence searches the wide-character string pointed to by
! \fIws1\fR for the first wide-character code that is \fInot\fR contained in the
! current separator string pointed to by \fIws2\fR. If no such wide-character
code is found, then there are no tokens in the wide-character string pointed to
! by \fIws1\fR, and \fBwcstok()\fR and \fBwstok()\fR return a null pointer. If
such a wide-character code is found, it is the start of the first token.
! .sp
! .LP
! The \fBwcstok()\fR and \fBwstok()\fR functions then search from that point for
! a wide-character code that \fIis\fR contained in the current separator string.
If no such wide-character code is found, the current token extends to the end
! of the wide-character string pointed to by \fIws1\fR, and subsequent searches
for a token will return a null pointer. If such a wide-character code is found,
it is overwritten by a null wide character, which terminates the current token.
! The \fBwcstok()\fR and \fBwstok()\fR functions save a pointer to the following
! wide-character code, from which the next search for a token will start.
! .sp
! .LP
Each subsequent call, with a null pointer as the value of the first argument,
starts searching from the saved pointer and behaves as described above.
! .sp
! .LP
Upon successful completion, both functions return a pointer to the first
wide-character code of a token. Otherwise, if there is no token, a null pointer
is returned.
! .SH ATTRIBUTES
! .sp
! .LP
! See \fBattributes\fR(5) for descriptions of the following attributes:
! .sp
!
! .sp
! .TS
! box;
! c | c
! l | l .
! ATTRIBUTE TYPE ATTRIBUTE VALUE
! _
! CSI Enabled
! _
! Interface Stability See NOTES.
! _
! MT-Level MT-Safe
! .TE
!
! .SH SEE ALSO
! .sp
! .LP
! \fBmalloc\fR(3C), \fBstring\fR(3C), \fBwcswidth\fR(3C), \fBwcwidth\fR(3C),
! \fBattributes\fR(5), \fBstandards\fR(5)
! .SH NOTES
! .sp
! .LP
! The \fBwcscat()\fR, \fBwcsncat()\fR, \fBwcscmp()\fR, \fBwcsncmp()\fR,
! \fBwcscpy()\fR, \fBwcsncpy()\fR, \fBwcslen()\fR, \fBwcschr()\fR,
! \fBwcsrchr()\fR, \fBwcspbrk()\fR, \fBwcswcs()\fR, \fBwcsspn()\fR,
! \fBwcscspn()\fR, and \fBwcstok()\fR functions are Standard. The \fBwscat()\fR,
! \fBwsncat()\fR, \fBwscmp()\fR, \fBwsncmp()\fR, \fBwscpy()\fR, \fBwsncpy()\fR,
! \fBwslen()\fR, \fBwschr()\fR, \fBwsrchr()\fR, \fBwspbrk()\fR, \fBwsspn()\fR,
! \fBwstok()\fR, \fBwindex()\fR, and \fBwrindex()\fR functions are Stable.
--- 1,595 ----
! .\" Copyright 2014 Garrett D'Amore <garrett@damore.org>
.\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved Portions Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
.\" http://www.opengroup.org/bookstore/.
.\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
.\" This notice shall appear on any product containing this material.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
! .Dd "Jul 22, 2014"
! .Dt WCSTRING 3C
! .Os
! .Sh NAME
! .Nm wcstring ,
! .Nm wcscat ,
! .Nm wscat ,
! .Nm wcsncat ,
! .Nm wsncat ,
! .Nm wcscmp ,
! .Nm wscmp ,
! .Nm wcsncmp ,
! .Nm wsncmp ,
! .Nm wcscpy ,
! .Nm wscpy ,
! .Nm wcsncpy ,
! .Nm wsncpy ,
! .Nm wcschr ,
! .Nm wschr ,
! .Nm wcsrchr ,
! .Nm wsrchr ,
! .Nm windex ,
! .Nm wrindex ,
! .Nm wcspbrk ,
! .Nm wspbrk ,
! .Nm wcswcs ,
! .Nm wcsspn ,
! .Nm wsspn ,
! .Nm wcscspn ,
! .Nm wscspn ,
! .Nm wcstok ,
! .Nm wstok
! .Nd wide-character string operations
! .
! .Sh SYNOPSIS
! .In wchar.h
! .
! .Ft "wchar_t *"
! .Fn wcscat "wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft "wchar_t *"
! .Fn wcsncat "wchar_t *restrict ws1" "const wchar_t *restrict ws2" "size_t n"
! .
! .Ft int
! .Fn wcscmp "const wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft int
! .Fn wcsncmp "const wchar_t *ws1" "const wchar_t *ws2" "size_t n"
! .
! .Ft "wchar_t *"
! .Fn wcscpy "wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft "wchar_t *"
! .Fn wcsncpy "wchar_t *restrict ws1" "const wchar_t *restrict ws2" "size_t n"
! .
! .Ft "wchar_t *"
! .Fn wcschr "const wchar_t *ws" "wchar_t wc"
! .
! .Ft "wchar_t *"
! .Fn wcsrchr "const wchar_t *ws" "wchar_t wc"
! .
! .Ft "wchar_t *"
! .Fn wcspbrk "const wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft "wchar_t *"
! .Fn wcswcs "const wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft size_t
! .Fn wcsspn "const wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft size_t
! .Fn wcscspn "const wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ss "XPG4 and SUS"
! .
! .Ft "wchar_t *"
! .Fn wcstok "wchar_t *restrict ws1" "const wchar_t *restrict ws2"
! .
! .Ss "Default and other standards"
! .
! .Ft "wchar_t *"
! .Fo wcstok
! .Fa "wchar_t *restrict ws1"
! .Fa "const wchar_t *restrict ws2"
! .Fa "wchar_t **restrict ptr"
! .Fc
! .
! .In widec.h
! .
! .Ft wchar_t *
! .Fn wscat "wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft "wchar_t *"
! .Fn wsncat "wchar_t *ws1" "const wchar_t *ws2" "size_t n"
! .
! .Ft int
! .Fn wscmp "const wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft int
! .Fn wsncmp "const wchar_t *ws1" "const wchar_t *ws2" "size_t n"
! .
! .Ft "wchar_t *"
! .Fn wscpy "wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft "wchar_t *"
! .Fn wsncpy "wchar_t *ws1" "const wchar_t *ws2" "size_t n"
! .
! .Ft "wchar_t *"
! .Fn wschr "const wchar_t *ws" "wchat_t wc"
! .
! .Ft "wchar_t *"
! .Fn wsrchr "const wchar_t *ws" "wchar_t wc"
! .
! .Ft "wchar_t *"
! .Fn wspbrk "const wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft size_t
! .Fn wsspn "const wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft size_t
! .Fn wscspn "const wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft "wchar_t *"
! .Fn wstok "wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft "wchar_t *"
! .Fn windex "const wchar_t *ws" "wchar_t wc"
! .
! .Ft "wchar_t *"
! .Fn wrindex "const wchar_t *ws" "wchar_t wc"
! .
! .Ss "ISO C++"
! .
! .In wchar.h
! .
! .Ft "const wchar_t *"
! .Fn wcschr "const wchar_t *ws" "wchar_t wc"
! .
! .Ft "const wchar_t *"
! .Fn wcspbrk "const wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft "const wchar_t *"
! .Fn wcsrchr "const wchar_t *ws" "wchar_t wc"
! .
! .In cwchar
! .
! .Ft wchar_t *
! .Fn std::wcschr "wchar_t *ws" "wchar_t wc"
! .
! .Ft "wchar_t *"
! .Fn std::wcspbrk "wchar_t *ws1" "const wchar_t *ws2"
! .
! .Ft "wchar_t *"
! .Fn std::wcsrchr "wchar_t *ws" "wchar_t wc"
! .
! .Sh DESCRIPTION
! .
! These functions operate on wide-character strings terminated by
! .Ft wchar_t
! null characters. During appending or copying, these routines do not check
! for an overflow condition of the receiving string. In the following,
! .Fa ws ,
! .Fa ws1 ,
! and
! .Fa ws2
! point to wide-character strings terminated by a
! .Ft wchar_t
! null, that is
! .Pq Vt wchar_t
! 0.
! .
! .Ss Fn wcscat , wscat
! .
! The
! .Fn wcscat and
! .Fn wscat
! functions append a copy of the
! wide-character string pointed to by
! .Fa ws2
! (including the terminating null
wide-character code) to the end of the wide-character string pointed to by
! .Fa ws1 .
! The initial wide-character code of
! .Fa ws2
! overwrites the null wide-character code at the end of
! .Fa ws1 .
! If copying takes place between
objects that overlap, the behavior is undefined. Both functions return
! .Fa ws1 ;
! no return value is reserved to indicate an error.
! .
! .Ss Fn wcsncat , wsncat
! .
! The
! .Fn wcsncat
! and
! .Fn wsncat
! functions append not more than
! .Fa n
wide-character codes (a null wide-character code and wide-character codes that
! follow it are not appended) from the array pointed to by
! .Fa ws2
! to the end of the wide-character string pointed to by
! .Fa ws1 .
! The initial wide-character code of
! .Fa ws2
! overwrites the null wide-character code at the
! end of
! .Fa ws1 .
! A terminating null wide-character code is always appended to
! the result. Both functions return
! .Fa ws1 ;
! no return value is reserved to indicate an error.
! .
! .Ss Fn wcscmp , wscmp
! .
! The
! .Fn wcscmp
! and
! .Fn wscmp
! functions compare the wide-character string pointed to by
! .Fa ws1
! to the wide-character string pointed to by
! .Fa ws2 .
! The sign of a non-zero return value is determined by the sign of the
difference between the values of the first pair of wide-character codes that
differ in the objects being compared. Upon completion, both functions return an
integer greater than, equal to, or less than zero, if the wide-character string
! pointed to by
! .Fa ws1
! is greater than, equal to, or less than the
! wide-character string pointed to by
! .Fa ws2 .
! .
! .Ss Fn wcsncmp , wsncmp
! .
! The
! .Fn wcsncmp
! and
! .Fn wsncmp
! functions compare not more than
! .Fa n
wide-character codes (wide-character codes that follow a null wide character
! code are not compared) from the array pointed to by
! .Fa ws1
! to the array pointed to by
! .Fa ws2 .
! The sign of a non-zero return value is determined by
the sign of the difference between the values of the first pair of
wide-character codes that differ in the objects being compared. Upon successful
completion, both functions return an integer greater than, equal to, or less
! than zero, if the possibly null-terminated array pointed to by
! .Fa ws1
! is
greater than, equal to, or less than the possibly null-terminated array pointed
! to by
! .Fa ws2 .
! .
! .Ss Fn wcscpy , wscpy
! .
! The
! .Fn wcscpy
! and
! .Fn wscpy
! functions copy the wide-character string
! pointed to by
! .Fa ws2
! (including the terminating null wide-character code)
! into the array pointed to by
! .Fa ws1 .
! If copying takes place between objects
! that overlap, the behavior is undefined. Both functions return
! .Fa ws1 ;
! no return value is reserved to indicate an error.
! .
! .Ss Fn wcsncpy , wsncpy
! .
! The
! .Fn wcsncpy
! and
! .Fn wsncpy
! functions copy not more than
! .Fa n
wide-character codes (wide-character codes that follow a null wide character
! code are not copied) from the array pointed to by
! .Fa ws2
! to the array pointed to by
! .Fa ws1 .
! If copying takes place between objects that overlap,
! the behavior is undefined. If the array pointed to by
! .Fa ws2
! is a wide-character string that is shorter than
! .Fa n
! wide-character codes, null
wide-character codes are appended to the copy in the array pointed to by
! .Fa ws1 ,
! until a total
! .Fa n
! wide-character codes are written. Both
! functions return
! .Fa ws1 ;
! no return value is reserved to indicate an error.
! .
! .Ss Fn wcschr , wschr , windex
! .
! The
! .Fn wcschr ,
! .Fn wschr
! and
! .Fn windex
! functions locate the first occurrence of
! .Fa wc
! in the wide-character string pointed to by
! .Fa ws .
! The value of
! .Fa wc
! must be a character representable as a type
! .Vt wchar_t
! and must be
a wide-character code corresponding to a valid character in the current locale.
The terminating null wide-character code is considered to be part of the
wide-character string. Upon completion, both functions return a pointer to the
wide-character code, or a null pointer if the wide-character code is not found.
! .
! .Ss Fn wcsrchr , wsrchr , wrindex
! .
! The
! .Fn wcsrchr ,
! .Fn wsrchr
! and
! .Fn wrindex
! functions locate the last occurrence of
! .Fa wc
! in the wide-character string pointed to by
! .Fa ws .
! The value of
! .Fa wc
! must be a character representable as a type
! .Vt wchar_t
! and must be
a wide-character code corresponding to a valid character in the current locale.
The terminating null wide-character code is considered to be part of the
wide-character string. Upon successful completion, both functions return a
! pointer to the wide-character code, or a null pointer if
! .Fa wc
! does not occur in the wide-character string.
! .
! .Ss wcspbrk , wspbrk
! .
! The
! .Fn wcspbrk
! and
! .Fn wspbrk
! functions locate the first occurrence in
! the wide character string pointed to by
! .Fa ws1
! of any wide-character code
! from the wide-character string pointed to by
! .Fa ws2 .
! Upon successful
completion, the function returns a pointer to the wide-character code, or a
! null pointer if no wide-character code from
! .Fa ws2
! occurs in
! .Fa ws1 .
! .
! .Ss "wcswcs(\|)"
! .
! The
! .Fn wcswcs
! function locates the first occurrence in the wide-character
! string pointed to by
! .Fa ws1
! of the sequence of wide-character codes
(excluding the terminating null wide-character code) in the wide-character
! string pointed to by
! .Fa ws2 .
! Upon successful completion, the function
returns a pointer to the located wide-character string, or a null pointer if
! the wide-character string is not found. If
! .Fa ws2
! points to a wide-character
! string with zero length, the function returns
! .Fa ws1 .
! .
! .Ss Fn wcsspn , wsspn
! .
! The
! .Fn wcsspn
! and
! .Fn wsspn
! functions return the length of the
! maximum initial segment of the wide-character string pointed to by
! .Fa ws1
which consists entirely of wide-character codes from the wide-character string
! pointed to by
! .Fa ws2 .
! No return value is reserved to indicate an error.
! .
! .Ss wcscspn , wscspn
! .
! The
! .Fn wcscspn
! and
! .Fn wscspn
! functions return the length of the
! maximum initial segment of the wide-character string pointed to by
! .Fa ws1
! which consists entirely of wide-character codes
! .Em not
! from the
! wide-character string pointed to by
! .Fa ws2 .
! No return value is reserved to indicate an error.
! .
! .Ss wcstok , wstok
! .
! A sequence of calls to the
! .Fn wcstok
! and
! .Fn wstok
! functions break the wide-character string pointed to by
! .Fa ws1
! into a sequence of tokens, each
of which is delimited by a wide-character code from the wide-character string
! pointed to by
! .Fa ws2 .
! The third argument points to a caller-provided
! .Ft wchar_t
! pointer into which
! the
! .Fn wcstok
! function stores information necessary for it to continue
scanning the same wide-character string. This argument is not available with
! the XPG4 legacy version of
! .Fn wcstok ,
! nor is it available with the
! .Fn wstok
! function. See
! .Xr standards 5 .
! .Lp
! The first call in the sequence has
! .Fa ws1
! as its first argument, and is
followed by calls with a null pointer as their first argument. The separator
! string pointed to by
! .Fa ws2
! may be different from call to call.
! .Lp
The first call in the sequence searches the wide-character string pointed to by
! .Fa ws1
! for the first wide-character code that is
! .Em not
! contained in the current separator string pointed to by
! .Fa ws2 .
! If no such wide-character
code is found, then there are no tokens in the wide-character string pointed to
! by
! .Fa ws1 ,
! and
! .Fn wcstok
! and
! .Fn wstok
! return a null pointer. If
such a wide-character code is found, it is the start of the first token.
! .Lp
! The
! .Fn wcstok
! and
! .Fn wstok
! functions then search from that point for
! a wide-character code that
! .Em is
! contained in the current separator string.
If no such wide-character code is found, the current token extends to the end
! of the wide-character string pointed to by
! .Fa ws1 ,
! and subsequent searches
for a token will return a null pointer. If such a wide-character code is found,
it is overwritten by a null wide character, which terminates the current token.
! The
! .Fn wcstok
! and
! .Fn wstok
! functions save a pointer to the following
! wide-character code into thread-specific storage, from which the next
! search for a token will start.
! .Lp
Each subsequent call, with a null pointer as the value of the first argument,
starts searching from the saved pointer and behaves as described above.
! .Lp
Upon successful completion, both functions return a pointer to the first
wide-character code of a token. Otherwise, if there is no token, a null pointer
is returned.
! .Sh CODE SET INDEPENDENCE
! .Sy Enabled .
! .Sh INTERFACE STABILITY
! The
! .Fn wcscat ,
! .Fn wcsncat ,
! .Fn wcscmp ,
! .Fn wcsncmp ,
! .Fn wcscpy ,
! .Fn wcsncpy ,
! .Fn wcschr ,
! .Fn wcsrchr ,
! .Fn wcspbrk ,
! .Fn wcsspn ,
! .Fn wcscspn ,
! and
! .Fn wcstok
! functions are
! .Sy Standard .
! .Lp
! The
! .Fn wcswcs
! function is
! .Sy Obsolete Standard .
! .Lp
! The
! .Fn wscat ,
! .Fn wsncat ,
! .Fn wscmp ,
! .Fn wsncmp ,
! .Fn wscpy ,
! .Fn wsncpy ,
! .Fn wslen ,
! .Fn wschr ,
! .Fn wsrchr ,
! .Fn wspbrk ,
! .Fn wsspn ,
! .Fn wstok ,
! .Fn windex ,
! and
! .Fn wrindex
! functions are
! .Sy Obsolete Committed .
! .
! .Sh MT-LEVEL
! .Sy MT-Safe .
! Note however that the legacy version of
! .Fn wcstok ,
! as well as
! .Fn wstok ,
! use thread-specific storage to store the tokenizer state. As a result,
! the tokenizer state will not be visible to other threads.
! .Sh SEE ALSO
! .Xr malloc 3C ,
! .Xr string 3C ,
! .Xr wcsdup 3C ,
! .Xr wcslen 3C ,
! .Xr wcsstr 3C ,
! .Xr wcswidth 3C ,
! .Xr wcwidth 3C ,
! .Xr standards 5
! .Sh STANDARDS
! The
! .Fn wcscat ,
! .Fn wcsncat ,
! .Fn wcscmp ,
! .Fn wcsncmp ,
! .Fn wcscpy ,
! .Fn wcsncpy ,
! .Fn wcschr ,
! .Fn wcsrchr ,
! .Fn wcspbrk ,
! .Fn wcsspn ,
! .Fn wcscspn ,
! .Fn wcstok
! and
! .Fn wcswcs
! functions were introduced in
! .St -xpg4 .
! The
! .Fn wcstok
! function was modified to take a third argument in
! .St -xbd5 .
! The
! .Fn wcswcs
! function was removed from
! .St -p1003.1-2008 ;
! the
! .Xr wcsstr 3C
! function specified by
! .St -isoC-99
! is preferred.