OSDN Git Service

(split) LDP: Update the version to 3.53 in PO files
[linuxjm/LDP_man-pages.git] / release / man3 / strtok.3
index 37d7f3e..a4589ab 100644 (file)
@@ -67,31 +67,21 @@ _XOPEN_SOURCE || _POSIX_SOURCE
 された文字列へのポインタが返される。この文字列には区切りバイトは含まれ
 ない。これ以上トークンが見つからなかった場合には、NULL が返される。
 
-A sequence of calls to \fBstrtok\fP()  that operate on the same string
-maintains a pointer that determines the point from which to start searching
-for the next token.  The first call to \fBstrtok\fP()  sets this pointer to
-point to the first byte of the string.  The start of the next token is
-determined by scanning forward for the next nondelimiter byte in \fIstr\fP.  If
-such a byte is found, it is taken as the start of the next token.  If no
-such byte is found, then there are no more tokens, and \fBstrtok\fP()  returns
-NULL.  (A string that is empty or that contains only delimiters will thus
-cause \fBstrtok\fP()  to return NULL on the first call.)
+同じ文字列に対して操作を行う \fBstrtok\fP() を連続して呼び出す場合、 次のトークンを探し始める位置を決めるためのポインタが保持される。 最初の
+\fBstrtok\fP の呼び出しでは、 このポインタは対象の文字列の最初のバイトにセットされる。 次のトークンの先頭は、 \fIstr\fP
+内で次の区切りバイト以外のバイトを前方に検索して決定される。 区切りバイト以外のバイトが見つからなかった場合は、 トークンはこれ以上なく、
+\fBstrtok\fP() は NULL を返す (したがって、 空の文字列や区切りバイトだけを含む文字列の場合には、 最初の \fBstrtok\fP()
+の呼び出しで NULL が返ることになる)。
 
-The end of each token is found by scanning forward until either the next
-delimiter byte is found or until the terminating null byte (\(aq\e0\(aq) is
-encountered.  If a delimiter byte is found, it is overwritten with a null
-byte to terminate the current token, and \fBstrtok\fP()  saves a pointer to the
-following byte; that pointer will be used as the starting point when
-searching for the next token.  In this case, \fBstrtok\fP()  returns a pointer
-to the start of the found token.
+各トークンの末尾は、次の区切りバイトが見つかるか、終端の NULL バイト (\(aq\e0\(aq)
+に達するまで文字列を前方に検索することで見つかる。 区切りバイトが見つかった場合には、 現在のトークンの終わりを示すために、 見つかった区切りバイトが
+NULL バイトで上書きされ、 \fBstrtok\fP() はポインタを次のバイトに設定する。
+このポインタは、次のトークンを検索する際の開始点として使用される。 この場合、 \fBstrtok\fP() は見つかったトークンの先頭へのポインタを返す。
 
-From the above description, it follows that a sequence of two or more
-contiguous delimiter bytes in the parsed string is considered to be a single
-delimiter, and that delimiter bytes at the start or end of the string are
-ignored.  Put another way: the tokens returned by \fBstrtok\fP()  are always
-nonempty strings.  Thus, for example, given the string "\fIaaa;;bbb,\fP",
-successive calls to \fBstrtok\fP()  that specify the delimiter string "\fI;,\fP"
-would return the strings "\fIaaa\fP" and "\fIbbb\fP", and then a NULL pointer.
+上記の説明の通り、 解析対象の文字列に 2 つ以上の区切りバイトが連続している場合には、 一つの区切りバイトとみなされ、
+文字列の先頭や末尾にある区切りバイトは無視される。 言い換えると、 \fBstrtok\fP() が返すトークンは必ず空でない文字列となる。
+したがって、例えば "\fIaaa;;bbb,\fP" という文字列が与えられたとすると、 区切り文字列 "\fI;,\fP" を指定した一連の
+\fBstrtok\fP() の呼び出しでは、 "\fIaaa\fP" と \fIbbb\fP" が返り、その次に NULL ポインタが返る。
 
 \fBstrtok_r\fP()  関数は \fBstrtok\fP()  のリエントラント版である。 \fIsaveptr\fP 引き数は \fIchar\ *\fP
 変数へのポインタであり、 同じ文字列の解析を行う \fBstrtok_r\fP()  の呼び出し間で処理状況を保存するために \fBstrtok_r\fP()
@@ -193,6 +183,6 @@ main(int argc, char *argv[])
 \fBindex\fP(3), \fBmemchr\fP(3), \fBrindex\fP(3), \fBstrchr\fP(3), \fBstring\fP(3),
 \fBstrpbrk\fP(3), \fBstrsep\fP(3), \fBstrspn\fP(3), \fBstrstr\fP(3), \fBwcstok\fP(3)
 .SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
 である。プロジェクトの説明とバグ報告に関する情報は
 http://www.kernel.org/doc/man\-pages/ に書かれている。