19ad39134STim J. Robbins.\" Copyright (c) 1998 Softweyr LLC. All rights reserved. 29ad39134STim J. Robbins.\" 39ad39134STim J. Robbins.\" strtok_r, from Berkeley strtok 49ad39134STim J. Robbins.\" Oct 13, 1998 by Wes Peters <wes@softweyr.com> 59ad39134STim J. Robbins.\" 69ad39134STim J. Robbins.\" Copyright (c) 1988, 1991, 1993 79ad39134STim J. Robbins.\" The Regents of the University of California. All rights reserved. 89ad39134STim J. Robbins.\" 99ad39134STim J. Robbins.\" This code is derived from software contributed to Berkeley by 109ad39134STim J. Robbins.\" the American National Standards Committee X3, on Information 119ad39134STim J. Robbins.\" Processing Systems. 129ad39134STim J. Robbins.\" 139ad39134STim J. Robbins.\" Redistribution and use in source and binary forms, with or without 149ad39134STim J. Robbins.\" modification, are permitted provided that the following conditions 159ad39134STim J. Robbins.\" are met: 169ad39134STim J. Robbins.\" 179ad39134STim J. Robbins.\" 1. Redistributions of source code must retain the above copyright 189ad39134STim J. Robbins.\" notices, this list of conditions and the following disclaimer. 199ad39134STim J. Robbins.\" 209ad39134STim J. Robbins.\" 2. Redistributions in binary form must reproduce the above 219ad39134STim J. Robbins.\" copyright notices, this list of conditions and the following 229ad39134STim J. Robbins.\" disclaimer in the documentation and/or other materials provided 239ad39134STim J. Robbins.\" with the distribution. 249ad39134STim J. Robbins.\" 259ad39134STim J. Robbins.\" 3. All advertising materials mentioning features or use of this 269ad39134STim J. Robbins.\" software must display the following acknowledgement: 279ad39134STim J. Robbins.\" 289ad39134STim J. Robbins.\" This product includes software developed by Softweyr LLC, the 299ad39134STim J. Robbins.\" University of California, Berkeley, and its contributors. 309ad39134STim J. Robbins.\" 319ad39134STim J. Robbins.\" 4. Neither the name of Softweyr LLC, the University nor the names 329ad39134STim J. Robbins.\" of its contributors may be used to endorse or promote products 339ad39134STim J. Robbins.\" derived from this software without specific prior written 349ad39134STim J. Robbins.\" permission. 359ad39134STim J. Robbins.\" 369ad39134STim J. Robbins.\" THIS SOFTWARE IS PROVIDED BY SOFTWEYR LLC, THE REGENTS AND 379ad39134STim J. Robbins.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 389ad39134STim J. Robbins.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 399ad39134STim J. Robbins.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 409ad39134STim J. Robbins.\" DISCLAIMED. IN NO EVENT SHALL SOFTWEYR LLC, THE REGENTS, OR 419ad39134STim J. Robbins.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 429ad39134STim J. Robbins.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 439ad39134STim J. Robbins.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 449ad39134STim J. Robbins.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 459ad39134STim J. Robbins.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 469ad39134STim J. Robbins.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 479ad39134STim J. Robbins.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 489ad39134STim J. Robbins.\" SUCH DAMAGE. 499ad39134STim J. Robbins.\" 509ad39134STim J. Robbins.\" $FreeBSD$ 519ad39134STim J. Robbins.\" 5261d74776STim J. Robbins.Dd October 3, 2002 539ad39134STim J. Robbins.Dt WCSTOK 3 549ad39134STim J. Robbins.Os 559ad39134STim J. Robbins.Sh NAME 569ad39134STim J. Robbins.Nm wcstok 579ad39134STim J. Robbins.Nd split wide-character string into tokens 589ad39134STim J. Robbins.Sh LIBRARY 599ad39134STim J. Robbins.Lb libc 609ad39134STim J. Robbins.Sh SYNOPSIS 619ad39134STim J. Robbins.In wchar.h 629ad39134STim J. Robbins.Ft wchar_t * 639ad39134STim J. Robbins.Fn wcstok "wchar_t * restrict str" "const wchar_t * restrict sep" "wchar_t ** restrict last" 649ad39134STim J. Robbins.Sh DESCRIPTION 659ad39134STim J. RobbinsThe 669ad39134STim J. Robbins.Fn wcstok 679ad39134STim J. Robbinsfunction 689ad39134STim J. Robbinsis used to isolate sequential tokens in a null-terminated wide character 699ad39134STim J. Robbinsstring, 709ad39134STim J. Robbins.Fa str . 719ad39134STim J. RobbinsThese tokens are separated in the string by at least one of the 729ad39134STim J. Robbinscharacters in 739ad39134STim J. Robbins.Fa sep . 749ad39134STim J. RobbinsThe first time that 758e4365cfSTim J. Robbins.Fn wcstok 769ad39134STim J. Robbinsis called, 779ad39134STim J. Robbins.Fa str 789ad39134STim J. Robbinsshould be specified; subsequent calls, wishing to obtain further tokens 799ad39134STim J. Robbinsfrom the same string, should pass a null pointer instead. 809ad39134STim J. RobbinsThe separator string, 819ad39134STim J. Robbins.Fa sep , 829ad39134STim J. Robbinsmust be supplied each time, and may change between calls. 839ad39134STim J. RobbinsThe context pointer 849ad39134STim J. Robbins.Fa last 859ad39134STim J. Robbinsmust be provided on each call. 869ad39134STim J. Robbins.Pp 879ad39134STim J. RobbinsThe 889ad39134STim J. Robbins.Fn wcstok 899ad39134STim J. Robbinsfunction is the wide character counterpart of the 909ad39134STim J. Robbins.Fn strtok_r 919ad39134STim J. Robbinsfunction. 929ad39134STim J. Robbins.Sh RETURN VALUES 939ad39134STim J. RobbinsThe 949ad39134STim J. Robbins.Fn wcstok 959ad39134STim J. Robbinsfunction 969ad39134STim J. Robbinsreturns a pointer to the beginning of each subsequent token in the string, 979ad39134STim J. Robbinsafter replacing the token itself with a null wide character (L'\e0'). 989ad39134STim J. RobbinsWhen no more tokens remain, a null pointer is returned. 9961d74776STim J. Robbins.Sh EXAMPLES 10061d74776STim J. RobbinsThe following code fragment splits a wide character string on 10161d74776STim J. Robbins.Tn ASCII 10261d74776STim J. Robbinsspace, tab and newline characters and writes the tokens to 10361d74776STim J. Robbinsstandard output: 10461d74776STim J. Robbins.Bd -literal -offset indent 10561d74776STim J. Robbinsconst wchar_t *seps = L" \et\en"; 10661d74776STim J. Robbinswchar_t *last, *tok, text[] = L" \enone\ettwo\et\etthree \en"; 10761d74776STim J. Robbins 10861d74776STim J. Robbinsfor (tok = wcstok(text, seps, &last); tok != NULL; 10961d74776STim J. Robbins tok = wcstok(NULL, seps, &last)) 11061d74776STim J. Robbins wprintf(L"%ls\en", tok); 11161d74776STim J. Robbins.Ed 1129ad39134STim J. Robbins.Sh COMPATIBILITY 1139ad39134STim J. RobbinsSome early implementations of 1149ad39134STim J. Robbins.Fn wcstok 1159ad39134STim J. Robbinsomit the 1169ad39134STim J. Robbinscontext pointer argument, 1179ad39134STim J. Robbins.Fa last , 1189ad39134STim J. Robbinsand maintain state across calls in a static variable like 1199ad39134STim J. Robbins.Fn strtok 1209ad39134STim J. Robbinsdoes. 1219ad39134STim J. Robbins.Sh SEE ALSO 12261d74776STim J. Robbins.Xr strtok 3 , 1239ad39134STim J. Robbins.Xr wcschr 3 , 1249ad39134STim J. Robbins.Xr wcscspn 3 , 1259ad39134STim J. Robbins.Xr wcspbrk 3 , 1269ad39134STim J. Robbins.Xr wcsrchr 3 , 127616e099eSTim J. Robbins.Xr wcsspn 3 1289ad39134STim J. Robbins.Sh STANDARDS 1299ad39134STim J. RobbinsThe 1309ad39134STim J. Robbins.Fn wcstok 1319ad39134STim J. Robbinsfunction 1329ad39134STim J. Robbinsconforms to 1339ad39134STim J. Robbins.St -isoC-99 . 134