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.\" 5061d74776STim J. Robbins.Dd October 3, 2002 519ad39134STim J. Robbins.Dt WCSTOK 3 529ad39134STim J. Robbins.Os 539ad39134STim J. Robbins.Sh NAME 549ad39134STim J. Robbins.Nm wcstok 559ad39134STim J. Robbins.Nd split wide-character string into tokens 569ad39134STim J. Robbins.Sh LIBRARY 579ad39134STim J. Robbins.Lb libc 589ad39134STim J. Robbins.Sh SYNOPSIS 599ad39134STim J. Robbins.In wchar.h 609ad39134STim J. Robbins.Ft wchar_t * 619ad39134STim J. Robbins.Fn wcstok "wchar_t * restrict str" "const wchar_t * restrict sep" "wchar_t ** restrict last" 629ad39134STim J. Robbins.Sh DESCRIPTION 639ad39134STim J. RobbinsThe 649ad39134STim J. Robbins.Fn wcstok 659ad39134STim J. Robbinsfunction 669ad39134STim J. Robbinsis used to isolate sequential tokens in a null-terminated wide character 679ad39134STim J. Robbinsstring, 689ad39134STim J. Robbins.Fa str . 699ad39134STim J. RobbinsThese tokens are separated in the string by at least one of the 709ad39134STim J. Robbinscharacters in 719ad39134STim J. Robbins.Fa sep . 729ad39134STim J. RobbinsThe first time that 738e4365cfSTim J. Robbins.Fn wcstok 749ad39134STim J. Robbinsis called, 759ad39134STim J. Robbins.Fa str 769ad39134STim J. Robbinsshould be specified; subsequent calls, wishing to obtain further tokens 779ad39134STim J. Robbinsfrom the same string, should pass a null pointer instead. 789ad39134STim J. RobbinsThe separator string, 799ad39134STim J. Robbins.Fa sep , 809ad39134STim J. Robbinsmust be supplied each time, and may change between calls. 819ad39134STim J. RobbinsThe context pointer 829ad39134STim J. Robbins.Fa last 839ad39134STim J. Robbinsmust be provided on each call. 849ad39134STim J. Robbins.Pp 859ad39134STim J. RobbinsThe 869ad39134STim J. Robbins.Fn wcstok 879ad39134STim J. Robbinsfunction is the wide character counterpart of the 889ad39134STim J. Robbins.Fn strtok_r 899ad39134STim J. Robbinsfunction. 909ad39134STim J. Robbins.Sh RETURN VALUES 919ad39134STim J. RobbinsThe 929ad39134STim J. Robbins.Fn wcstok 939ad39134STim J. Robbinsfunction 949ad39134STim J. Robbinsreturns a pointer to the beginning of each subsequent token in the string, 959ad39134STim J. Robbinsafter replacing the token itself with a null wide character (L'\e0'). 969ad39134STim J. RobbinsWhen no more tokens remain, a null pointer is returned. 9761d74776STim J. Robbins.Sh EXAMPLES 9861d74776STim J. RobbinsThe following code fragment splits a wide character string on 9961d74776STim J. Robbins.Tn ASCII 10061d74776STim J. Robbinsspace, tab and newline characters and writes the tokens to 10161d74776STim J. Robbinsstandard output: 10261d74776STim J. Robbins.Bd -literal -offset indent 10361d74776STim J. Robbinsconst wchar_t *seps = L" \et\en"; 10461d74776STim J. Robbinswchar_t *last, *tok, text[] = L" \enone\ettwo\et\etthree \en"; 10561d74776STim J. Robbins 10661d74776STim J. Robbinsfor (tok = wcstok(text, seps, &last); tok != NULL; 10761d74776STim J. Robbins tok = wcstok(NULL, seps, &last)) 10861d74776STim J. Robbins wprintf(L"%ls\en", tok); 10961d74776STim J. Robbins.Ed 1109ad39134STim J. Robbins.Sh COMPATIBILITY 1119ad39134STim J. RobbinsSome early implementations of 1129ad39134STim J. Robbins.Fn wcstok 1139ad39134STim J. Robbinsomit the 1149ad39134STim J. Robbinscontext pointer argument, 1159ad39134STim J. Robbins.Fa last , 1169ad39134STim J. Robbinsand maintain state across calls in a static variable like 1179ad39134STim J. Robbins.Fn strtok 1189ad39134STim J. Robbinsdoes. 1199ad39134STim J. Robbins.Sh SEE ALSO 12061d74776STim J. Robbins.Xr strtok 3 , 1219ad39134STim J. Robbins.Xr wcschr 3 , 1229ad39134STim J. Robbins.Xr wcscspn 3 , 1239ad39134STim J. Robbins.Xr wcspbrk 3 , 1249ad39134STim J. Robbins.Xr wcsrchr 3 , 125616e099eSTim J. Robbins.Xr wcsspn 3 1269ad39134STim J. Robbins.Sh STANDARDS 1279ad39134STim J. RobbinsThe 1289ad39134STim J. Robbins.Fn wcstok 1299ad39134STim J. Robbinsfunction 1309ad39134STim J. Robbinsconforms to 1319ad39134STim J. Robbins.St -isoC-99 . 132