--- /dev/null
+.\" Copyright 1995 by Jim Van Zandt <jrv@vanzandt.mv.com>
+.\"
+.\" %%%LICENSE_START(VERBATIM)
+.\" Permission is granted to make and distribute verbatim copies of this
+.\" manual provided the copyright notice and this permission notice are
+.\" preserved on all copies.
+.\"
+.\" Permission is granted to copy and distribute modified versions of this
+.\" manual under the conditions for verbatim copying, provided that the
+.\" entire resulting derived work is distributed under the terms of a
+.\" permission notice identical to this one.
+.\"
+.\" Since the Linux kernel and libraries are constantly changing, this
+.\" manual page may be incorrect or out-of-date. The author(s) assume no
+.\" responsibility for errors or omissions, or for damages resulting from
+.\" the use of the information contained herein. The author(s) may not
+.\" have taken the same level of care in the production of this manual,
+.\" which is licensed free of charge, as they might when working
+.\" professionally.
+.\"
+.\" Formatted or processed versions of this manual, if unaccompanied by
+.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
+.\"
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.\"
+.\" Japanese Version Copyright (c) 1999 ishikawa, keisuke
+.\" all rights reserved.
+.\" Translated Tue Mar 9 08:21:04 JST 1999
+.\" by ishikawa, keisuke <ishikawa@sgk.gr.jp>
+.\" Updated & Modified Sun Jan 20 11:31:46 JST 2002
+.\" by Yuichi SATO <ysato@h4.dion.ne.jp>
+.\" Updated 2013-05-06, Akihiro MOTOKI <amotoki@gmail.com>
+.\"
+.TH TSEARCH 3 2020\-11\-01 GNU "Linux Programmer's Manual"
+.SH 名前
+tsearch, tfind, tdelete, twalk, tdestroy \- 二分探索木 (binary search tree) の操作
+.SH 書式
+.nf
+\fB#include <search.h>\fP
+.PP
+\fBtypedef enum { preorder, postorder, endorder, leaf } VISIT;\fP
+.PP
+\fBvoid *tsearch(const void *\fP\fIkey\fP\fB, void **\fP\fIrootp\fP\fB,\fP
+\fB int (*\fP\fIcompar\fP\fB)(const void *, const void *));\fP
+.PP
+\fBvoid *tfind(const void *\fP\fIkey\fP\fB, void *const *\fP\fIrootp\fP\fB,\fP
+\fB int (*\fP\fIcompar\fP\fB)(const void *, const void *));\fP
+.PP
+\fBvoid *tdelete(const void *\fP\fIkey\fP\fB, void **\fP\fIrootp\fP\fB,\fP
+\fB int (*\fP\fIcompar\fP\fB)(const void *, const void *));\fP
+.PP
+\fBvoid twalk(const void *\fP\fIroot\fP\fB,\fP
+\fB void (*\fP\fIaction\fP\fB)(const void *\fP\fInodep\fP\fB, VISIT \fP\fIwhich\fP\fB,\fP
+\fB int \fP\fIdepth\fP\fB));\fP
+.PP
+\fB#define _GNU_SOURCE\fP /* feature_test_macros(7) 参照 */
+\fB#include <search.h>\fP
+.PP
+\fBvoid twalk_r(const void *\fP\fIroot\fP\fB,\fP
+\fB void (*\fP\fIaction\fP\fB)(const void *\fP\fInodep\fP\fB, VISIT \fP\fIwhich\fP\fB,\fP
+\fB void *\fP\fIclosure\fP\fB),\fP
+\fB void *\fP\fIclosure\fP\fB);\fP
+.PP
+\fBvoid tdestroy(void *\fP\fIroot\fP\fB, void (*\fP\fIfree_node\fP\fB)(void *\fP\fInodep\fP\fB));\fP
+.fi
+.SH 説明
+\fBtsearch\fP(), \fBtfind\fP(), \fBtwalk\fP(), \fBtdelete\fP() は 二分探索木を操作する関数である。
+これらの関数は Knuth (6.2.2) Algorithm T に基づいている。 木構造における各ノードの最初のフィールドは、対応するデータ
+アイテムへのポインターである。 (参照先のデータは、呼び出しプログラムで用意する。) \fIcompar\fP は比較ルーチンへのポインターである。
+比較ルーチンは、アイテムへのポインター 2 つを引き数に持つ。 比較ルーチンの返り値は、1 つ目のアイテムが 2 つ目のアイテムよりも
+「小さい、等しい、大きい」によって、 「負、0、正」の整数値でなければならない。
+.PP
+\fBtsearch\fP() searches the tree for an item. \fIkey\fP points to the item to
+be searched for. \fIrootp\fP points to a variable which points to the root of
+the tree. If the tree is empty, then the variable that \fIrootp\fP points to
+should be set to NULL. If the item is found in the tree, then \fBtsearch\fP()
+returns a pointer to the corresponding tree node. (In other words,
+\fBtsearch\fP() returns a pointer to a pointer to the data item.) If the item
+is not found, then \fBtsearch\fP() adds it, and returns a pointer to the
+corresponding tree node.
+.PP
+\fBtfind\fP() は、 \fBtsearch\fP() に似ているが、 アイテムが見つからなかった場合 NULL を返す点が異なる。
+.PP
+\fBtdelete\fP() は木構造からアイテムを削除する。 引き数は \fBtsearch\fP() と同じである。
+.PP
+\fBtwalk\fP() は、二分木を深さ優先 (depth\-first) で、 左から右にたどっていく関数である。 \fIroot\fP
+は起点となるノードへのポインターである。 \fIroot\fP に根以外のノードを指定すると、部分木が対象となる。 \fBtwalk\fP()
+は、ノードを訪れる度にユーザー関数 \fIaction\fP を呼び出す (内部ノードに対しては 3 回、葉に対しては 1 回呼び出しが行われる)。
+\fIaction\fP には以下の順に 3 つの引き数が与えられる。 最初の引き数は訪れたノードへのポインターである。 ノードの構造体は規定されていないが、
+ポインターを要素へのポインターのポインターにキャストし、 ノードに格納された要素にアクセスすることができる。
+アプリケーションは、この引き数が指す構造体を変更してはならない。 2 番目の引き数には、内部ノードの場合は訪問回数に応じて \fBpreorder\fP,
+\fBpostorder\fP, \fBendorder\fP のいずれかの整数が、 葉を最初に訪れた場合は \fBleaf\fP の値が渡される (これらのシンボルは
+\fI<search.h>\fP で定義されている)。 3 番目の引き数はノードの深さで、根の場合は深さ 0 である。
+.PP
+(より一般的には、\fBpreorder\fP, \fBpostorder\fP, \fBendorder\fP は \fBpreorder\fP, \fBinorder\fP,
+\fBpostorder\fP として知られている: それぞれ、子要素を辿る前・最初の子要素を辿った後かつ 2 番目の子要素を辿る前・
+子要素を辿った後ということを表している。 よって \fBpost\%order\fP という名前を選ぶのは少し紛らわしい。)
+.PP
+\fBtwalk_r\fP() is similar to \fBtwalk\fP(), but instead of the \fIdepth\fP
+argument, the \fIclosure\fP argument pointer is passed to each invocation of
+the action callback, unchanged. This pointer can be used to pass
+information to and from the callback function in a thread\-safe fashion,
+without resorting to global variables.
+.PP
+\fBtdestroy\fP() は \fIroot\fP が指す木構造全体を削除し、 \fBtsearch\fP() 関数で確保されたリソースを全て解放する。
+木構造の各ノードについて、関数 \fIfree_node\fP が呼び出される。 データへのポインターがこの関数の引き数として渡される。
+そのような動作が必要でなければ、 \fIfree_node\fP は何もしない関数へのポインターでなければならない。
+.SH 返り値
+\fBtsearch\fP() returns a pointer to a matching node in the tree, or to the
+newly added node, or NULL if there was insufficient memory to add the item.
+\fBtfind\fP() returns a pointer to the node, or NULL if no match is found. If
+there are multiple items that match the key, the item whose node is returned
+is unspecified.
+.PP
+\fBtdelete\fP() returns a pointer to the parent of the node deleted, or NULL
+if the item was not found. If the deleted node was the root node,
+\fBtdelete\fP() returns a dangling pointer that must not be accessed.
+.PP
+\fIrootp\fP が NULL の場合、 \fBtsearch\fP(), \fBtfind\fP(), \fBtdelete\fP() は NULL を返す。
+.SH バージョン
+\fBtwalk_r\fP() は glibc バージョン 2.30 以降で利用可能である。
+.SH 属性
+この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。
+.TS
+allbox;
+lb lb lb
+l l l.
+インターフェース 属性 値
+T{
+\fBtsearch\fP(),
+\fBtfind\fP(),
+.br
+\fBtdelete\fP()
+T} Thread safety MT\-Safe race:rootp
+T{
+\fBtwalk\fP()
+T} Thread safety MT\-Safe race:root
+T{
+\fBtwalk_r\fP()
+T} Thread safety MT\-Safe race:root
+T{
+\fBtdestroy\fP()
+T} Thread safety MT\-Safe
+.TE
+.SH 準拠
+POSIX.1\-2001, POSIX.1\-2008, SVr4. The functions \fBtdestroy\fP() and
+\fBtwalk_r\fP() are GNU extensions.
+.SH 注意
+\fBtwalk\fP() は根へのポインターを引き数にとるが、 ほかの関数は根へのポインターへのポインターである。
+.PP
+\fBtdelete\fP() は、削除したノードの使用していたメモリーを解放するが、
+ノードに対応するデータのメモリーは、ユーザーが解放しなければならない。
+.PP
+下のプログラム例は、ユーザー関数が "endorder" か "leaf" を引き数にして 呼び出されて以降は、 \fBtwalk\fP()
+がそのノードを参照しないことを前提としている。 これは GNU ライブラリの実装では機能するが、System V のマニュアルには存在しない。
+.SH 例
+以下のプログラムは 12 個の乱数を二分木に挿入した後、 挿入した数を順番に出力する (挿入の際、重複した乱数は 1 つにまとめられる)。
+.PP
+.EX
+#define _GNU_SOURCE /* Expose declaration of tdestroy() */
+#include <search.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <time.h>
+
+static void *root = NULL;
+
+static void *
+xmalloc(size_t n)
+{
+ void *p;
+ p = malloc(n);
+ if (p)
+ return p;
+ fprintf(stderr, "insufficient memory\en");
+ exit(EXIT_FAILURE);
+}
+
+static int
+compare(const void *pa, const void *pb)
+{
+ if (*(int *) pa < *(int *) pb)
+ return \-1;
+ if (*(int *) pa > *(int *) pb)
+ return 1;
+ return 0;
+}
+
+static void
+action(const void *nodep, VISIT which, int depth)
+{
+ int *datap;
+
+ switch (which) {
+ case preorder:
+ break;
+ case postorder:
+ datap = *(int **) nodep;
+ printf("%6d\en", *datap);
+ break;
+ case endorder:
+ break;
+ case leaf:
+ datap = *(int **) nodep;
+ printf("%6d\en", *datap);
+ break;
+ }
+}
+
+int
+main(void)
+{
+ int **val;
+
+ srand(time(NULL));
+ for (int i = 0; i < 12; i++) {
+ int *ptr = xmalloc(sizeof(*ptr));
+ *ptr = rand() & 0xff;
+ val = tsearch(ptr, &root, compare);
+ if (val == NULL)
+ exit(EXIT_FAILURE);
+ else if (*val != ptr)
+ free(ptr);
+ }
+ twalk(root, action);
+ tdestroy(root, free);
+ exit(EXIT_SUCCESS);
+}
+.EE
+.SH 関連項目
+\fBbsearch\fP(3), \fBhsearch\fP(3), \fBlsearch\fP(3) \fBqsort\fP(3)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は
+\%https://www.kernel.org/doc/man\-pages/ に書かれている。
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2021-03-12 14:01+0900\n"
-"PO-Revision-Date: 2021-03-26 13:50+0900\n"
+"PO-Revision-Date: 2021-04-02 21:59+0900\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
#. type: TH
#: build/C/man3/bsearch.3:31 build/C/man3/hsearch.3:35 build/C/man3/qsort.3:37
#: build/C/man3/tsearch.3:25
-#, fuzzy, no-wrap
-#| msgid "2003-11-01"
+#, no-wrap
msgid "2020-11-01"
-msgstr "2003-11-01"
+msgstr "2020-11-01"
#. type: TH
#: build/C/man3/bsearch.3:31 build/C/man3/hsearch.3:35
#. type: Plain text
#: build/C/man3/bsearch.3:92
msgid "POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD."
-msgstr ""
+msgstr "POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD."
#. type: SH
#: build/C/man3/bsearch.3:92 build/C/man3/hsearch.3:299
#: build/C/man3/qsort.3:121 build/C/man3/tsearch.3:266
-#, fuzzy, no-wrap
-#| msgid "EXAMPLE"
+#, no-wrap
msgid "EXAMPLES"
msgstr "例"
#. type: Plain text
#: build/C/man3/bsearch.3:121
-#, fuzzy, no-wrap
-#| msgid ""
-#| "static int\n"
-#| "compmi(const void *m1, const void *m2)\n"
-#| "{\n"
-#| " struct mi *mi1 = (struct mi *) m1;\n"
-#| " struct mi *mi2 = (struct mi *) m2;\n"
-#| " return strcmp(mi1-E<gt>name, mi2-E<gt>name);\n"
-#| "}\n"
+#, no-wrap
msgid ""
"static int\n"
"compmi(const void *m1, const void *m2)\n"
"static int\n"
"compmi(const void *m1, const void *m2)\n"
"{\n"
-" struct mi *mi1 = (struct mi *) m1;\n"
-" struct mi *mi2 = (struct mi *) m2;\n"
+" const struct mi *mi1 = m1;\n"
+" const struct mi *mi2 = m2;\n"
" return strcmp(mi1-E<gt>name, mi2-E<gt>name);\n"
"}\n"
" struct mi key;\n"
" struct mi *res;\n"
msgstr ""
+"int\n"
+"main(int argc, char **argv)\n"
+"{\n"
+" qsort(months, nr_of_months, sizeof(months[0]), compmi);\n"
+" for (int i = 1; i E<lt> argc; i++) {\n"
+" struct mi key;\n"
+" struct mi *res;\n"
#. type: Plain text
#: build/C/man3/bsearch.3:140
-#, fuzzy, no-wrap
-#| msgid ""
-#| " qsort(months, nr_of_months, sizeof(struct mi), compmi);\n"
-#| " for (i = 1; i E<lt> argc; i++) {\n"
-#| " struct mi key, *res;\n"
-#| " key.name = argv[i];\n"
-#| " res = bsearch(&key, months, nr_of_months,\n"
-#| " sizeof(struct mi), compmi);\n"
-#| " if (res == NULL)\n"
-#| " printf(\"\\(aq%s\\(aq: unknown month\\en\", argv[i]);\n"
-#| " else\n"
-#| " printf(\"%s: month #%d\\en\", res-E<gt>name, res-E<gt>nr);\n"
-#| " }\n"
-#| " exit(EXIT_SUCCESS);\n"
-#| "}\n"
+#, no-wrap
msgid ""
" key.name = argv[i];\n"
" res = bsearch(&key, months, nr_of_months,\n"
" exit(EXIT_SUCCESS);\n"
"}\n"
msgstr ""
-" qsort(months, nr_of_months, sizeof(struct mi), compmi);\n"
-" for (i = 1; i E<lt> argc; i++) {\n"
-" struct mi key, *res;\n"
" key.name = argv[i];\n"
" res = bsearch(&key, months, nr_of_months,\n"
-" sizeof(struct mi), compmi);\n"
+" sizeof(months[0]), compmi);\n"
" if (res == NULL)\n"
" printf(\"\\(aq%s\\(aq: unknown month\\en\", argv[i]);\n"
" else\n"
#. type: Plain text
#: build/C/man3/hsearch.3:51 build/C/man3/tsearch.3:49
-#, fuzzy, no-wrap
-#| msgid "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
+#, no-wrap
msgid ""
"B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
"B<#include E<lt>search.hE<gt>>\n"
-msgstr "B<#define _GNU_SOURCE> /* feature_test_macros(7) 参照 */\n"
+msgstr ""
+"B<#define _GNU_SOURCE> /* feature_test_macros(7) 参照 */\n"
+"B<#include E<lt>search.hE<gt>>\n"
#. type: Plain text
#: build/C/man3/hsearch.3:53
#. type: Plain text
#: build/C/man3/hsearch.3:117
-#, fuzzy
-#| msgid ""
-#| "The function B<hdestroy>() frees the memory occupied by the hash table "
-#| "that was created by B<hcreate>(). After calling B<hdestroy>() a new "
-#| "hash table can be created using B<hcreate>(). The B<hdestroy_r>() "
-#| "function performs the analogous task for a hash table described by "
-#| "I<*htab>, which was previously created using B<hcreate_r>()."
msgid ""
"The function B<hdestroy>() frees the memory occupied by the hash table that "
"was created by B<hcreate>(). After calling B<hdestroy>(), a new hash table "
#. PROX.1-2001, POSIX.1-2008
#. type: Plain text
#: build/C/man3/hsearch.3:230
-#, fuzzy
-#| msgid "POSIX.1-2001 specifies only the B<ENOMEM> error."
msgid "POSIX.1 specifies only the B<ENOMEM> error."
-msgstr "POSIX.1-2001 が規定しているのは、エラー B<ENOMEM> だけである。"
+msgstr "POSIX.1 が規定しているのは、エラー B<ENOMEM> だけである。"
#. type: tbl table
#: build/C/man3/hsearch.3:241
#. type: Plain text
#: build/C/man3/hsearch.3:258
-#, fuzzy
-#| msgid ""
-#| "The functions B<hcreate>(), B<hsearch>(), and B<hdestroy>() are from "
-#| "SVr4, and are described in POSIX.1-2001. The functions B<hcreate_r>(), "
-#| "B<hsearch_r>(), and B<hdestroy_r>() are GNU extensions."
msgid ""
"The functions B<hcreate>(), B<hsearch>(), and B<hdestroy>() are from SVr4, "
"and are described in POSIX.1-2001 and POSIX.1-2008."
-msgstr ""
-"関数 B<hcreate>(), B<hsearch>(), B<hdestroy>() は SVr4 から導入されたもの"
-"で、POSIX.1-2001 に記述されている。 関数 B<hcreate_r>, B<hsearch_r>, "
-"B<hdestroy_r> は GNU の拡張である。"
+msgstr "関数 B<hcreate>(), B<hsearch>(), B<hdestroy>() は SVr4 から導入されたもので、POSIX.1-2001 と POSIX.1-2008 に記述されている。"
#. type: Plain text
#: build/C/man3/hsearch.3:265
-#, fuzzy
-#| msgid ""
-#| "The B<hcreate_r>(), B<hsearch_r>(), and B<hdestroy_r>() functions are "
-#| "thread-safe."
msgid ""
"The functions B<hcreate_r>(), B<hsearch_r>(), and B<hdestroy_r>() are GNU "
"extensions."
-msgstr ""
-"関数 B<hcreate_r>(), B<hsearch_r>(), B<hdestroy_r>() はスレッドセーフである。"
+msgstr "関数 B<hcreate_r>(), B<hsearch_r>(), B<hdestroy_r>() は GNU による拡張である。"
#. type: SH
#: build/C/man3/hsearch.3:265 build/C/man3/qsort.3:117
#. type: Plain text
#: build/C/man3/hsearch.3:320
-#, fuzzy, no-wrap
-#| msgid ""
-#| "int\n"
-#| "main(void)\n"
-#| "{\n"
-#| " ENTRY e, *ep;\n"
-#| " int i;\n"
+#, no-wrap
msgid ""
"int\n"
"main(void)\n"
" ENTRY e;\n"
" ENTRY *ep;\n"
msgstr ""
-"int main()\n"
+"int\n"
+"main(void)\n"
"{\n"
-" ENTRY e, *ep;\n"
-" int i;\n"
+" ENTRY e;\n"
+" ENTRY *ep;\n"
#. type: Plain text
#: build/C/man3/hsearch.3:322
#. type: Plain text
#: build/C/man3/hsearch.3:335
-#, fuzzy, no-wrap
-#| msgid ""
-#| " for (i = 0; i E<lt> 24; i++) {\n"
-#| " e.key = data[i];\n"
-#| " /* data is just an integer, instead of a\n"
-#| " pointer to something */\n"
-#| " e.data = (void *) i;\n"
-#| " ep = hsearch(e, ENTER);\n"
-#| " /* there should be no failures */\n"
-#| " if (ep == NULL) {\n"
-#| " fprintf(stderr, \"entry failed\\en\");\n"
-#| " exit(EXIT_FAILURE);\n"
-#| " }\n"
-#| " }\n"
+#, no-wrap
msgid ""
" for (int i = 0; i E<lt> 24; i++) {\n"
" e.key = data[i];\n"
" }\n"
" }\n"
msgstr ""
-" for (i = 0; i E<lt> 24; i++) {\n"
+" for (int i = 0; i E<lt> 24; i++) {\n"
" e.key = data[i];\n"
" /* データは、ポインターではなく、単なる整数値である。 */\n"
" e.data = (void *) i;\n"
#. type: Plain text
#: build/C/man3/hsearch.3:347
-#, fuzzy, no-wrap
-#| msgid ""
-#| " for (i = 22; i E<lt> 26; i++) {\n"
-#| " /* print two entries from the table, and\n"
-#| " show that two are not in the table */\n"
-#| " e.key = data[i];\n"
-#| " ep = hsearch(e, FIND);\n"
-#| " printf(\"%9.9s -E<gt> %9.9s:%d\\en\", e.key,\n"
-#| " ep ? ep-E<gt>key : \"NULL\", ep ? (int)(ep-E<gt>data) : 0);\n"
-#| " }\n"
-#| " hdestroy();\n"
-#| " exit(EXIT_SUCCESS);\n"
-#| "}\n"
+#, no-wrap
msgid ""
" for (int i = 22; i E<lt> 26; i++) {\n"
" /* print two entries from the table, and\n"
" exit(EXIT_SUCCESS);\n"
"}\n"
msgstr ""
-" for (i = 22; i E<lt> 26; i++) {\n"
+" for (int i = 22; i E<lt> 26; i++) {\n"
" /* テーブルにある 2 つのエントリーを表示し、\n"
" あとの 2 つがテーブルにないことを示す。 */\n"
" e.key = data[i];\n"
#: build/C/man3/lsearch.3:26
#, no-wrap
msgid "2017-09-15"
-msgstr ""
+msgstr "2017-09-15"
#. type: Plain text
#: build/C/man3/lsearch.3:29
"B<lfind>(),\n"
"B<lsearch>()"
msgstr ""
+"B<lfind>(),\n"
+"B<lsearch>()"
#. type: Plain text
#: build/C/man3/lsearch.3:97
-#, fuzzy
-#| msgid "SVr4, 4.3BSD, POSIX.1-2001. Present in libc since libc-4.6.27."
msgid ""
"POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD. Present in libc since libc-4.6.27."
-msgstr ""
-"SVr4, 4.3BSD, POSIX.1-2001. libc には libc-4.6.27 以降で実装されている。"
+msgstr "POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD. libc には libc-4.6.27 以降で実装されている。"
#. type: Plain text
#: build/C/man3/lsearch.3:99
"B<qsort>(),\n"
"B<qsort_r>()"
msgstr ""
+"B<qsort>(),\n"
+"B<qsort_r>()"
#. type: Plain text
#: build/C/man3/qsort.3:117
msgid "B<qsort>(): POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD."
-msgstr ""
+msgstr "B<qsort>(): POSIX.1-2001, POSIX.1-2008, C89, C99, SVr4, 4.3BSD."
#. type: Plain text
#: build/C/man3/qsort.3:121
-#, fuzzy
-#| msgid ""
-#| "Library routines suitable for use as the I<compar> argument to "
-#| "B<qsort>() include B<alphasort>(3) and B<versionsort>(3). To compare C "
-#| "strings, the comparison function can call B<strcmp>(3), as shown in the "
-#| "example below."
msgid ""
"To compare C strings, the comparison function can call B<strcmp>(3), as "
"shown in the example below."
-msgstr ""
-"B<qsort>() の I<compar> 引き数に使用するのに適しているライブラリルーチンと\n"
-"しては B<alphasort>(3), B<versionsort>(3) がある。 C の文字列を比較する場"
-"合、\n"
-"以下の例にあるように比較関数で B<strcmp>(3) を呼び出すこともできる。"
+msgstr "C の文字列を比較する場合、以下の例にあるように比較関数で B<strcmp>(3) を呼び出すこともできる。"
#. type: Plain text
#: build/C/man3/qsort.3:124
#. type: Plain text
#: build/C/man3/qsort.3:142
-#, fuzzy, no-wrap
-#| msgid ""
-#| " return strcmp(* (char * const *) p1, * (char * const *) p2);\n"
-#| "}\n"
+#, no-wrap
msgid ""
" return strcmp(*(const char **) p1, *(const char **) p2);\n"
"}\n"
msgstr ""
-" return strcmp(* (char * const *) p1, * (char * const *) p2);\n"
+" return strcmp(*(const char **) p1, *(const char **) p2);\n"
"}\n"
#. type: Plain text
#: build/C/man3/qsort.3:150
-#, fuzzy, no-wrap
-#| msgid ""
-#| " if (argc E<lt> 2) {\n"
-#| " fprintf(stderr, \"Usage: %s E<lt>stringE<gt>...\\en\", argv[0]);\n"
-#| " exit(EXIT_FAILURE);\n"
-#| " }\n"
+#, no-wrap
msgid ""
"int\n"
"main(int argc, char *argv[])\n"
" exit(EXIT_FAILURE);\n"
" }\n"
msgstr ""
+"int\n"
+"main(int argc, char *argv[])\n"
+"{\n"
" if (argc E<lt> 2) {\n"
" fprintf(stderr, \"Usage: %s E<lt>stringE<gt>...\\en\", argv[0]);\n"
" exit(EXIT_FAILURE);\n"
#. type: Plain text
#: build/C/man3/qsort.3:157
-#, fuzzy, no-wrap
-#| msgid ""
-#| " for (j = 1; j E<lt> argc; j++)\n"
-#| " puts(argv[j]);\n"
-#| " exit(EXIT_SUCCESS);\n"
-#| "}\n"
+#, no-wrap
msgid ""
" for (int j = 1; j E<lt> argc; j++)\n"
" puts(argv[j]);\n"
" exit(EXIT_SUCCESS);\n"
"}\n"
msgstr ""
-" for (j = 1; j E<lt> argc; j++)\n"
+" for (int j = 1; j E<lt> argc; j++)\n"
" puts(argv[j]);\n"
" exit(EXIT_SUCCESS);\n"
"}\n"
#. type: Plain text
#: build/C/man3/tsearch.3:28
-#, fuzzy
-#| msgid "tsearch, tfind, tdelete, twalk, tdestroy - manage a binary tree"
msgid "tsearch, tfind, tdelete, twalk, tdestroy - manage a binary search tree"
-msgstr "tsearch, tfind, tdelete, twalk, tdestroy - äº\8cå\88\86æ\9c¨ (binary tree) の操作"
+msgstr "tsearch, tfind, tdelete, twalk, tdestroy - äº\8cå\88\86æ\8e¢ç´¢æ\9c¨ (binary search tree) の操作"
#. type: Plain text
#: build/C/man3/tsearch.3:33
#, no-wrap
msgid "B<typedef enum { preorder, postorder, endorder, leaf } VISIT;>\n"
-msgstr ""
+msgstr "B<typedef enum { preorder, postorder, endorder, leaf } VISIT;>\n"
#. type: Plain text
#: build/C/man3/tsearch.3:36
#. type: Plain text
#: build/C/man3/tsearch.3:46
-#, fuzzy, no-wrap
-#| msgid ""
-#| "B<void twalk(const void *>I<root>B<, void (*>I<action>B<)(const void *>I<nodep>B<,>\n"
-#| "B< const VISIT >I<which>B<,>\n"
-#| "B< const int >I<depth>B<));>\n"
+#, no-wrap
msgid ""
"B<void twalk(const void *>I<root>B<,>\n"
"B< void (*>I<action>B<)(const void *>I<nodep>B<, VISIT >I<which>B<,>\n"
"B< int >I<depth>B<));>\n"
msgstr ""
-"B<void twalk(const void *>I<root>B<, void (*>I<action>B<)(const void *>I<nodep>B<,>\n"
-"B< const VISIT >I<which>B<,>\n"
-"B< const int >I<depth>B<));>\n"
+"B<void twalk(const void *>I<root>B<,>\n"
+"B< void (*>I<action>B<)(const void *>I<nodep>B<, VISIT >I<which>B<,>\n"
+"B< int >I<depth>B<));>\n"
#. type: Plain text
#: build/C/man3/tsearch.3:54
-#, fuzzy, no-wrap
-#| msgid ""
-#| "B<void twalk(const void *>I<root>B<, void (*>I<action>B<)(const void *>I<nodep>B<,>\n"
-#| "B< const VISIT >I<which>B<,>\n"
-#| "B< const int >I<depth>B<));>\n"
+#, no-wrap
msgid ""
"B<void twalk_r(const void *>I<root>B<,>\n"
"B< void (*>I<action>B<)(const void *>I<nodep>B<, VISIT >I<which>B<,>\n"
"B< void *>I<closure>B<),>\n"
"B< void *>I<closure>B<);>\n"
msgstr ""
-"B<void twalk(const void *>I<root>B<, void (*>I<action>B<)(const void *>I<nodep>B<,>\n"
-"B< const VISIT >I<which>B<,>\n"
-"B< const int >I<depth>B<));>\n"
+"B<void twalk_r(const void *>I<root>B<,>\n"
+"B< void (*>I<action>B<)(const void *>I<nodep>B<, VISIT >I<which>B<,>\n"
+"B< void *>I<closure>B<),>\n"
+"B< void *>I<closure>B<);>\n"
#. type: Plain text
#: build/C/man3/tsearch.3:56
#. type: Plain text
#: build/C/man3/tsearch.3:75
-#, fuzzy
-#| msgid ""
-#| "B<tsearch>(), B<tfind>(), B<twalk>(), and B<tdelete>() manage a binary "
-#| "tree. They are generalized from Knuth (6.2.2) Algorithm T. The first "
-#| "field in each node of the tree is a pointer to the corresponding data "
-#| "item. (The calling program must store the actual data.) I<compar> "
-#| "points to a comparison routine, which takes pointers to two items. It "
-#| "should return an integer which is negative, zero, or positive, depending "
-#| "on whether the first item is less than, equal to, or greater than the "
-#| "second."
msgid ""
"B<tsearch>(), B<tfind>(), B<twalk>(), and B<tdelete>() manage a binary "
"search tree. They are generalized from Knuth (6.2.2) Algorithm T. The "
"to a comparison routine, which takes pointers to two items. It should "
"return an integer which is negative, zero, or positive, depending on whether "
"the first item is less than, equal to, or greater than the second."
-msgstr ""
-"B<tsearch>(), B<tfind>(), B<twalk>(), B<tdelete>() は 二分木を操作する関数で"
-"ある。 これらの関数は Knuth (6.2.2) Algorithm T に基づいている。 木構造におけ"
-"る各ノードの最初のフィールドは、対応するデータ アイテムへのポインターであ"
-"る。 (参照先のデータは、呼び出しプログラムで用意する。) I<compar> は比較ルー"
-"チンへのポインターである。 比較ルーチンは、アイテムへのポインター 2 つを引き"
-"数に持つ。 比較ルーチンの返り値は、1 つ目のアイテムが 2 つ目のアイテムよりも "
-"「小さい、等しい、大きい」によって、 「負、0、正」の整数値でなければならな"
-"い。"
+msgstr "B<tsearch>(), B<tfind>(), B<twalk>(), B<tdelete>() は 二分探索木を操作する関数である。 これらの関数は Knuth (6.2.2) Algorithm T に基づいている。 木構造における各ノードの最初のフィールドは、対応するデータ アイテムへのポインターである。 (参照先のデータは、呼び出しプログラムで用意する。) I<compar> は比較ルーチンへのポインターである。 比較ルーチンは、アイテムへのポインター 2 つを引き数に持つ。 比較ルーチンの返り値は、1 つ目のアイテムが 2 つ目のアイテムよりも 「小さい、等しい、大きい」によって、 「負、0、正」の整数値でなければならない。"
#. type: Plain text
#: build/C/man3/tsearch.3:97
#. type: Plain text
#: build/C/man3/tsearch.3:218
-#, fuzzy
-#| msgid "B<qsort_r>() was added to glibc in version 2.8."
msgid "B<twalk_r>() is available in glibc since version 2.30."
-msgstr "B<qsort_r>() は glibc バージョン 2.8 で追加された。"
+msgstr "B<twalk_r>() は glibc バージョン 2.30 以降で利用可能である。"
#. type: tbl table
#: build/C/man3/tsearch.3:229
#. type: Plain text
#: build/C/man3/tsearch.3:278
-#, fuzzy, no-wrap
-#| msgid ""
-#| "#define _GNU_SOURCE /* Expose declaration of tdestroy() */\n"
-#| "#include E<lt>search.hE<gt>\n"
-#| "#include E<lt>stdlib.hE<gt>\n"
-#| "#include E<lt>stdio.hE<gt>\n"
-#| "#include E<lt>time.hE<gt>\n"
+#, no-wrap
msgid ""
"#define _GNU_SOURCE /* Expose declaration of tdestroy() */\n"
"#include E<lt>search.hE<gt>\n"
msgstr ""
"#define _GNU_SOURCE /* Expose declaration of tdestroy() */\n"
"#include E<lt>search.hE<gt>\n"
+"#include E<lt>stddef.hE<gt>\n"
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>time.hE<gt>\n"
#. type: Plain text
#: build/C/man3/tsearch.3:291
-#, fuzzy, no-wrap
-#| msgid ""
-#| "static void *\n"
-#| "xmalloc(unsigned n)\n"
-#| "{\n"
-#| " void *p;\n"
-#| " p = malloc(n);\n"
-#| " if (p)\n"
-#| " return p;\n"
-#| " fprintf(stderr, \"insufficient memory\\en\");\n"
-#| " exit(EXIT_FAILURE);\n"
-#| "}\n"
+#, no-wrap
msgid ""
"static void *\n"
"xmalloc(size_t n)\n"
"}\n"
msgstr ""
"static void *\n"
-"xmalloc(unsigned n)\n"
+"xmalloc(size_t n)\n"
"{\n"
" void *p;\n"
" p = malloc(n);\n"
#. type: Plain text
#: build/C/man3/tsearch.3:306
-#, fuzzy, no-wrap
-#| msgid ""
-#| "static void\n"
-#| "action(const void *nodep, const VISIT which, const int depth)\n"
-#| "{\n"
-#| " int *datap;\n"
+#, no-wrap
msgid ""
"static void\n"
"action(const void *nodep, VISIT which, int depth)\n"
" int *datap;\n"
msgstr ""
"static void\n"
-"action(const void *nodep, const VISIT which, const int depth)\n"
+"action(const void *nodep, VISIT which, int depth)\n"
"{\n"
" int *datap;\n"
#. type: Plain text
#: build/C/man3/tsearch.3:327
-#, fuzzy, no-wrap
-#| msgid ""
-#| "int\n"
-#| "main(void)\n"
-#| "{\n"
-#| " int i, *ptr;\n"
-#| " void *val;\n"
+#, no-wrap
msgid ""
"int\n"
"main(void)\n"
"int\n"
"main(void)\n"
"{\n"
-" int i, *ptr;\n"
-" void *val;\n"
+" int **val;\n"
#. type: Plain text
#: build/C/man3/tsearch.3:342
-#, fuzzy, no-wrap
-#| msgid ""
-#| " srand(time(NULL));\n"
-#| " for (i = 0; i E<lt> 12; i++) {\n"
-#| " ptr = xmalloc(sizeof(int));\n"
-#| " *ptr = rand() & 0xff;\n"
-#| " val = tsearch((void *) ptr, &root, compare);\n"
-#| " if (val == NULL)\n"
-#| " exit(EXIT_FAILURE);\n"
-#| " else if ((*(int **) val) != ptr)\n"
-#| " free(ptr);\n"
-#| " }\n"
-#| " twalk(root, action);\n"
-#| " tdestroy(root, free);\n"
-#| " exit(EXIT_SUCCESS);\n"
-#| "}\n"
+#, no-wrap
msgid ""
" srand(time(NULL));\n"
" for (int i = 0; i E<lt> 12; i++) {\n"
"}\n"
msgstr ""
" srand(time(NULL));\n"
-" for (i = 0; i E<lt> 12; i++) {\n"
-" ptr = xmalloc(sizeof(int));\n"
+" for (int i = 0; i E<lt> 12; i++) {\n"
+" int *ptr = xmalloc(sizeof(*ptr));\n"
" *ptr = rand() & 0xff;\n"
-" val = tsearch((void *) ptr, &root, compare);\n"
+" val = tsearch(ptr, &root, compare);\n"
" if (val == NULL)\n"
" exit(EXIT_FAILURE);\n"
-" else if ((*(int **) val) != ptr)\n"
+" else if (*val != ptr)\n"
" free(ptr);\n"
" }\n"
" twalk(root, action);\n"