1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
10 .\" Dinkumware C library reference http://www.dinkumware.com/
11 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
14 .\" About this Japanese page, please contact to JM Project <JM@linux.or.jp>
15 .\" Translated Sat Oct 23 17:53:50 JST 1999
16 .\" by FUJIWARA Teruyoshi <fujiwara@linux.or.jp>
18 .TH WCSTOK 3 1999-07-25 "GNU" "Linux Programmer's Manual"
21 .\"O wcstok \- split wide-character string into tokens
22 wcstok \- ¥ï¥¤¥Éʸ»úʸ»úÎó¤ò¥È¡¼¥¯¥ó¤Ëʬ³ä¤¹¤ë
28 .BI "wchar_t *wcstok(wchar_t *" wcs ", const wchar_t *" delim \
35 .\"O function is the wide-character equivalent of the
38 .\"O with an added argument to make it multithread-safe. It can be used
39 .\"O to split a wide-character string \fIwcs\fP into tokens, where a token is
40 .\"O defined as a substring not containing any wide-characters from \fIdelim\fP.
44 ´Ø¿ô¤ËÂбþ¤¹¤ë¥ï¥¤¥Éʸ»ú´Ø¿ô¤Ë¡¢
45 ¥Þ¥ë¥Á¥¹¥ì¥Ã¥É¥»¡¼¥Õ¤ÎÆ°ºî¤ò¤µ¤»¤ë¤¿¤á¤Î°ú¤¿ô¤òÄɲä·¤¿¤â¤Î¤Ç¤¢¤ë¡£
46 ¤³¤Î´Ø¿ô¤òÍѤ¤¤Æ¡¢¥ï¥¤¥Éʸ»úʸ»úÎó \fIwcs\fP ¤ò¥È¡¼¥¯¥ó¤Ëʬ²ò¤¹¤ë¤³¤È
47 ¤¬¤Ç¤¤ë¡£¤³¤³¤Ç¡¢¥È¡¼¥¯¥ó¤Ï \fIdelim\fP ¤ËÎóµó¤µ¤ì¤Æ¤¤¤ëʸ»ú¤ò´Þ¤Þ¤Ê
48 ¤¤Éôʬʸ»úÎó¤È¤·¤ÆÄêµÁ¤µ¤ì¤ë¡£
50 .\"O The search starts at \fIwcs\fP, if \fIwcs\fP is not NULL,
51 .\"O or at \fI*ptr\fP, if \fIwcs\fP is NULL.
52 .\"O First, any delimiter wide-characters are skipped, that is, the
53 .\"O pointer is advanced beyond any wide-characters which occur in \fIdelim\fP.
54 ¸¡º÷¤Ï \fIwcs\fP ¤¬ NULL ¤Ç¤Ê¤±¤ì¤Ð \fIwcs\fP ¤«¤é³«»Ï¤µ¤ì¡¢\fIwcs\fP
55 ¤¬ NULL ¤Ê¤é¤Ð \fI*ptr\fP ¤«¤é³«»Ï¤µ¤ì¤ë¡£¤Þ¤º¡¢Á´¤Æ¤Î¶èÀÚ¤ê¥ï¥¤¥Éʸ»ú
56 ¤¬¥¹¥¥Ã¥×¤µ¤ì¤ë¡£¤Ä¤Þ¤ê¡¢\fIdelim\fP ¤Ë´Þ¤Þ¤ì¤ë¥ï¥¤¥Éʸ»ú¤òĶ¤¨¤ë¤è¤¦
57 ¤Ë¥Ý¥¤¥ó¥¿¤¬Á°¤Ë¿Ê¤á¤é¤ì¤ë¡£
58 .\"O If the end of the wide-character string is now reached,
60 .\"O returns NULL, to indicate that no tokens
61 .\"O were found, and stores an appropriate value in \fI*ptr\fP,
62 .\"O so that subsequent calls to
64 .\"O will continue to return NULL.
67 .\"O function recognizes the beginning of a token
68 .\"O and returns a pointer to it, but before doing that, it zero-terminates the
69 .\"O token by replacing the next wide-character which occurs in \fIdelim\fP with
70 .\"O a L\(aq\\0\(aq character,
71 .\"O and it updates \fI*ptr\fP so that subsequent calls will
72 .\"O continue searching after the end of recognized token.
73 ¥ï¥¤¥Éʸ»úʸ»úÎó¤Î½ª¤ï¤ê¤Ë㤷¤¿¤é¡¢
76 ¥È¡¼¥¯¥ó¤¬Á´¤¯¸«¤Ä¤«¤é¤Ê¤«¤Ã¤¿¤³¤È¤ò¼¨¤·¡¢¤³¤Î¸å¤Ë
79 ½Ð¤·¤Æ¤â NULL ¤¬ÊÖ¤µ¤ì¤ë¤è¤¦¤Ë \fI*ptr\fP ¤ËŬÀÚ¤ÊÃͤòÀßÄꤹ¤ë¡£¤½¤ì
82 ´Ø¿ô¤Ï¥È¡¼¥¯¥ó¤ÎÀèƬ¤ò¼±Ê̤·¡¢¤³¤ì¤ò»Ø¤¹
83 ¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£¤¿¤À¤·¤³¤ì¤ò¹Ô¤¦Á°¤Ë¡¢¥È¡¼¥¯¥ó¤Î¸å¤Ë¤¢¤ë¡¢\fIdelim\fP
84 ¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ëʸ»ú¤ò L\(aq\\0\(aq ¤ËÃÖ¤´¹¤¨¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥È¡¼¥¯¥ó¤ò 0 ¤Ç
85 ½ªÃ¼¤µ¤»¤ë¡£¤µ¤é¤Ë \fI*ptr\fP ¤ò¹¹¿·¤·¡¢¸å¤Ç
88 ºÝ¤Ë¡¢¼±Ê̤µ¤ì¤¿¥È¡¼¥¯¥ó¤Î³¤¤«¤é¸¡º÷¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¡£
89 .\"O .SH "RETURN VALUE"
93 .\"O function returns a pointer to the next token,
94 .\"O or NULL if no further token was found.
96 ´Ø¿ô¤Ï¼¡¤Î¥È¡¼¥¯¥ó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£¥È¡¼¥¯¥ó¤¬¸«¤Ä¤«¤é
97 ¤Ê¤±¤ì¤Ð NULL ¤òÊÖ¤¹¡£
98 .\"O .SH "CONFORMING TO"
103 .\"O The original \fIwcs\fP wide-character string is destructively modified during
105 ´Ø¿ô¤ËÍ¿¤¨¤¿¥ï¥¤¥Éʸ»úÎó \fIwcs\fP ¤Ï¡¢´Ø¿ô¤ÎÆ°ºî¤Ë¤è¤Ã¤Æ´°Á´¤Ë½ñ¤´¹
109 .\"O The following code loops over the tokens contained in a wide-character string.
110 °Ê²¼¤Î¥³¡¼¥É¤Ï¡¢¥ï¥¤¥Éʸ»úʸ»úÎó¤Ë´Þ¤Þ¤ì¤ë¥È¡¼¥¯¥ó¤ò¼è¤ê½Ð¤·¤Ê¤¬¤é
117 for (token = wcstok(wcs, " \\t\\n", &state);
119 token = wcstok(NULL, " \\t\\n", &state)) {