OSDN Git Service

(split) LDP: Update the version to 3.53 in PO files
[linuxjm/LDP_man-pages.git] / draft / man3 / strtok.3
index 2e61554..a4589ab 100644 (file)
@@ -55,10 +55,9 @@ glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参
 _XOPEN_SOURCE || _POSIX_SOURCE
 .ad b
 .SH 説明
-The \fBstrtok\fP()  function breaks a string into a sequence of zero or more
-nonempty tokens.  On the first call to \fBstrtok\fP()  the string to be parsed
-should be specified in \fIstr\fP.  In each subsequent call that should parse
-the same string, \fIstr\fP must be NULL.
+\fBstrtok\fP()  関数は文字列を 0 個以上の空でないトークンの列に分割する。 \fBstrtok\fP()
+を最初に呼び出す際には、解析対象の文字列を \fIstr\fP に 指定する。同じ文字列の解析を行うその後の呼び出しでは、 \fIstr\fP は NULL
+にしなければならない。
 
 \fIdelim\fP 引き数には、解析対象の文字列をトークンに区切るのに使用する
 バイト集合を指定する。同じ文字列を解析する一連の呼び出しにおいて、
@@ -68,36 +67,25 @@ the same string, \fIstr\fP must be NULL.
 された文字列へのポインタが返される。この文字列には区切りバイトは含まれ
 ない。これ以上トークンが見つからなかった場合には、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 ポインタが返る。
 
-The \fBstrtok_r\fP()  function is a reentrant version \fBstrtok\fP().  The
-\fIsaveptr\fP argument is a pointer to a \fIchar\ *\fP variable that is used
-internally by \fBstrtok_r\fP()  in order to maintain context between successive
-calls that parse the same string.
+\fBstrtok_r\fP()  関数は \fBstrtok\fP()  のリエントラント版である。 \fIsaveptr\fP 引き数は \fIchar\ *\fP
+変数へのポインタであり、 同じ文字列の解析を行う \fBstrtok_r\fP()  の呼び出し間で処理状況を保存するために \fBstrtok_r\fP()
+内部で使用される。
 
 \fBstrtok_r\fP()  を最初に呼び出す際には、 \fIstr\fP は解析対象の文字列を指していなければならず、 \fIsaveptr\fP
 の値は無視される。それ以降の呼び出しでは、 \fIstr\fP は NULL とし、 \fIsaveptr\fP
@@ -106,11 +94,11 @@ calls that parse the same string.
 \fBstrtok_r\fP()  の呼び出し時に異なる \fIsaveptr\fP 引き数を指定することで、 異なる文字列の解析を同時に行うことができる。
 .SH 返り値
 \fBstrtok\fP()  と \fBstrtok_r\fP()  は次のトークンへのポインタか、 トークンがなければ NULL を返す。
-.SH ATTRIBUTES
-.SS "Multithreading (see pthreads(7))"
-The \fBstrtok\fP()  function is not thread\-safe.
+.SH 属性
+.SS "マルチスレッディング (pthreads(7) 参照)"
+The \fBstrtok\fP() 関数はスレッドセーフではない。
 .LP
-The \fBstrtok_r\fP()  function is thread\-safe.
+\fBstrtok_r\fP() 関数はスレッドセーフである。
 .SH 準拠
 .TP 
 \fBstrtok\fP()
@@ -195,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/ に書かれている。