OSDN Git Service

(split) LDP: Snapshotis of ja.po for v3.41.
[linuxjm/LDP_man-pages.git] / po4a / search / po / ja.po
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: PACKAGE VERSION\n"
9 "POT-Creation-Date: 2012-05-28 07:17+0900\n"
10 "PO-Revision-Date: 2012-05-28 07:45+0900\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13 "Language: \n"
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
17
18 #. type: TH
19 #: build/C/man3/bsearch.3:29
20 #, no-wrap
21 msgid "BSEARCH"
22 msgstr "BSEARCH"
23
24 #. type: TH
25 #: build/C/man3/bsearch.3:29
26 #, no-wrap
27 msgid "2003-11-01"
28 msgstr "2003-11-01"
29
30 #. type: TH
31 #: build/C/man3/bsearch.3:29 build/C/man3/hsearch.3:35
32 #: build/C/man3/insque.3:34 build/C/man3/lsearch.3:25 build/C/man3/qsort.3:35
33 #: build/C/man3/tsearch.3:24
34 #, no-wrap
35 msgid "Linux Programmer's Manual"
36 msgstr "Linux Programmer's Manual"
37
38 #. type: SH
39 #: build/C/man3/bsearch.3:30 build/C/man3/hsearch.3:36
40 #: build/C/man3/insque.3:35 build/C/man3/lsearch.3:26 build/C/man3/qsort.3:36
41 #: build/C/man3/tsearch.3:25
42 #, no-wrap
43 msgid "NAME"
44 msgstr "名前"
45
46 #. type: Plain text
47 #: build/C/man3/bsearch.3:32
48 msgid "bsearch - binary search of a sorted array"
49 msgstr "bsearch - ソートされた配列を二分木検索 (binary search) する"
50
51 #. type: SH
52 #: build/C/man3/bsearch.3:32 build/C/man3/hsearch.3:39
53 #: build/C/man3/insque.3:37 build/C/man3/lsearch.3:28 build/C/man3/qsort.3:38
54 #: build/C/man3/tsearch.3:27
55 #, no-wrap
56 msgid "SYNOPSIS"
57 msgstr "書式"
58
59 #. type: Plain text
60 #: build/C/man3/bsearch.3:35 build/C/man3/qsort.3:41
61 #, no-wrap
62 msgid "B<#include E<lt>stdlib.hE<gt>>\n"
63 msgstr "B<#include E<lt>stdlib.hE<gt>>\n"
64
65 #. type: Plain text
66 #: build/C/man3/bsearch.3:39
67 #, no-wrap
68 msgid ""
69 "B<void *bsearch(const void *>I<key>B<, const void *>I<base>B<,>\n"
70 "B<              size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
71 "B<              int (*>I<compar>B<)(const void *, const void *));>\n"
72 msgstr ""
73 "B<void *bsearch(const void *>I<key>B<, const void *>I<base>B<,>\n"
74 "B<              size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
75 "B<              int (*>I<compar>B<)(const void *, const void *));>\n"
76
77 #. type: SH
78 #: build/C/man3/bsearch.3:40 build/C/man3/hsearch.3:60
79 #: build/C/man3/insque.3:59 build/C/man3/lsearch.3:38 build/C/man3/qsort.3:59
80 #: build/C/man3/tsearch.3:50
81 #, no-wrap
82 msgid "DESCRIPTION"
83 msgstr "説明"
84
85 #. type: Plain text
86 #: build/C/man3/bsearch.3:48
87 msgid ""
88 "The B<bsearch>()  function searches an array of I<nmemb> objects, the "
89 "initial member of which is pointed to by I<base>, for a member that matches "
90 "the object pointed to by I<key>.  The size of each member of the array is "
91 "specified by I<size>."
92 msgstr ""
93 "B<bsearch>()  関数は I<nmemb> 個のオブジェクトからなる配列を検索 する。配列の"
94 "最初のメンバーへのポインタは I<base> によって与える。 ポインタ I<key> で参照"
95 "されるオブジェクトと一致するメンバーが返される。 配列中の各々のメンバーのサイ"
96 "ズは I<size> によって指定する。"
97
98 #. type: Plain text
99 #: build/C/man3/bsearch.3:57
100 msgid ""
101 "The contents of the array should be in ascending sorted order according to "
102 "the comparison function referenced by I<compar>.  The I<compar> routine is "
103 "expected to have two arguments which point to the I<key> object and to an "
104 "array member, in that order, and should return an integer less than, equal "
105 "to, or greater than zero if the I<key> object is found, respectively, to be "
106 "less than, to match, or be greater than the array member."
107 msgstr ""
108 "配列の内容は比較関数 I<compar> に基づき、昇順にソートされていなけれ ばならな"
109 "い。 I<compar> ルーチンは二つの引数を取る関数で、一つ 目に I<key> へのポイン"
110 "タ、次に配列のメンバーへのポインタを取る。 この順に指定したとき、 I<key> が配"
111 "列メンバーより小さいときには 負の整数を、大きいときには正の整数を、一致したと"
112 "きには 0 を、それぞれ I<compar> は返さなければならない。"
113
114 #. type: SH
115 #: build/C/man3/bsearch.3:57 build/C/man3/hsearch.3:174
116 #: build/C/man3/lsearch.3:58 build/C/man3/qsort.3:89
117 #: build/C/man3/tsearch.3:132
118 #, no-wrap
119 msgid "RETURN VALUE"
120 msgstr "返り値"
121
122 #. type: Plain text
123 #: build/C/man3/bsearch.3:64
124 msgid ""
125 "The B<bsearch>()  function returns a pointer to a matching member of the "
126 "array, or NULL if no match is found.  If there are multiple elements that "
127 "match the key, the element returned is unspecified."
128 msgstr ""
129 "B<bsearch>()  関数は、配列のメンバーのうち、一致したものへのポインタを 返す。"
130 "見つからなかったときは NULL を返す。 I<key> と一致したメンバーが 複数あると"
131 "き、そのうちのどのメンバーが返されるかはわからない。"
132
133 #. type: SH
134 #: build/C/man3/bsearch.3:64 build/C/man3/hsearch.3:226
135 #: build/C/man3/insque.3:97 build/C/man3/lsearch.3:66 build/C/man3/qsort.3:98
136 #: build/C/man3/tsearch.3:153
137 #, no-wrap
138 msgid "CONFORMING TO"
139 msgstr "準拠"
140
141 #. type: Plain text
142 #: build/C/man3/bsearch.3:66
143 msgid "SVr4, 4.3BSD, POSIX.1-2001, C89, C99."
144 msgstr "SVr4, 4.3BSD, POSIX.1-2001, C89, C99."
145
146 #. type: SH
147 #: build/C/man3/bsearch.3:66 build/C/man3/hsearch.3:273
148 #: build/C/man3/insque.3:132 build/C/man3/qsort.3:114
149 #: build/C/man3/tsearch.3:181
150 #, no-wrap
151 msgid "EXAMPLE"
152 msgstr "例"
153
154 #. type: Plain text
155 #: build/C/man3/bsearch.3:71
156 msgid ""
157 "The example below first sorts an array of structures using B<qsort>(3), then "
158 "retrieves desired elements using B<bsearch>()."
159 msgstr ""
160 "以下の例は、 B<qsort>(3)  を使って構造体の配列の並び換えを行った後、 所望の要"
161 "素を B<bsearch>()  を使って取得するものである。"
162
163 #. type: Plain text
164 #: build/C/man3/bsearch.3:76 build/C/man3/qsort.3:125
165 #, no-wrap
166 msgid ""
167 "#include E<lt>stdio.hE<gt>\n"
168 "#include E<lt>stdlib.hE<gt>\n"
169 "#include E<lt>string.hE<gt>\n"
170 msgstr ""
171 "#include E<lt>stdio.hE<gt>\n"
172 "#include E<lt>stdlib.hE<gt>\n"
173 "#include E<lt>string.hE<gt>\n"
174
175 #. type: Plain text
176 #: build/C/man3/bsearch.3:85
177 #, no-wrap
178 msgid ""
179 "struct mi {\n"
180 "    int nr;\n"
181 "    char *name;\n"
182 "} months[] = {\n"
183 "    { 1, \"jan\" }, { 2, \"feb\" }, { 3, \"mar\" }, { 4, \"apr\" },\n"
184 "    { 5, \"may\" }, { 6, \"jun\" }, { 7, \"jul\" }, { 8, \"aug\" },\n"
185 "    { 9, \"sep\" }, {10, \"oct\" }, {11, \"nov\" }, {12, \"dec\" }\n"
186 "};\n"
187 msgstr ""
188 "struct mi {\n"
189 "    int nr;\n"
190 "    char *name;\n"
191 "} months[] = {\n"
192 "    { 1, \"jan\" }, { 2, \"feb\" }, { 3, \"mar\" }, { 4, \"apr\" },\n"
193 "    { 5, \"may\" }, { 6, \"jun\" }, { 7, \"jul\" }, { 8, \"aug\" },\n"
194 "    { 9, \"sep\" }, {10, \"oct\" }, {11, \"nov\" }, {12, \"dec\" }\n"
195 "};\n"
196
197 #. type: Plain text
198 #: build/C/man3/bsearch.3:87
199 #, no-wrap
200 msgid "#define nr_of_months (sizeof(months)/sizeof(months[0]))\n"
201 msgstr "#define nr_of_months (sizeof(months)/sizeof(months[0]))\n"
202
203 #. type: Plain text
204 #: build/C/man3/bsearch.3:95
205 #, no-wrap
206 msgid ""
207 "static int\n"
208 "compmi(const void *m1, const void *m2)\n"
209 "{\n"
210 "    struct mi *mi1 = (struct mi *) m1;\n"
211 "    struct mi *mi2 = (struct mi *) m2;\n"
212 "    return strcmp(mi1-E<gt>name, mi2-E<gt>name);\n"
213 "}\n"
214 msgstr ""
215 "static int\n"
216 "compmi(const void *m1, const void *m2)\n"
217 "{\n"
218 "    struct mi *mi1 = (struct mi *) m1;\n"
219 "    struct mi *mi2 = (struct mi *) m2;\n"
220 "    return strcmp(mi1-E<gt>name, mi2-E<gt>name);\n"
221 "}\n"
222
223 #. type: Plain text
224 #: build/C/man3/bsearch.3:100
225 #, no-wrap
226 msgid ""
227 "int\n"
228 "main(int argc, char **argv)\n"
229 "{\n"
230 "    int i;\n"
231 msgstr ""
232 "int\n"
233 "main(int argc, char **argv)\n"
234 "{\n"
235 "    int i;\n"
236
237 #. type: Plain text
238 #: build/C/man3/bsearch.3:114
239 #, no-wrap
240 msgid ""
241 "    qsort(months, nr_of_months, sizeof(struct mi), compmi);\n"
242 "    for (i = 1; i E<lt> argc; i++) {\n"
243 "        struct mi key, *res;\n"
244 "        key.name = argv[i];\n"
245 "        res = bsearch(&key, months, nr_of_months,\n"
246 "                      sizeof(struct mi), compmi);\n"
247 "        if (res == NULL)\n"
248 "            printf(\"\\(aq%s\\(aq: unknown month\\en\", argv[i]);\n"
249 "        else\n"
250 "            printf(\"%s: month #%d\\en\", res-E<gt>name, res-E<gt>nr);\n"
251 "    }\n"
252 "    exit(EXIT_SUCCESS);\n"
253 "}\n"
254 msgstr ""
255 "    qsort(months, nr_of_months, sizeof(struct mi), compmi);\n"
256 "    for (i = 1; i E<lt> argc; i++) {\n"
257 "        struct mi key, *res;\n"
258 "        key.name = argv[i];\n"
259 "        res = bsearch(&key, months, nr_of_months,\n"
260 "                      sizeof(struct mi), compmi);\n"
261 "        if (res == NULL)\n"
262 "            printf(\"\\(aq%s\\(aq: unknown month\\en\", argv[i]);\n"
263 "        else\n"
264 "            printf(\"%s: month #%d\\en\", res-E<gt>name, res-E<gt>nr);\n"
265 "    }\n"
266 "    exit(EXIT_SUCCESS);\n"
267 "}\n"
268
269 #. type: SH
270 #: build/C/man3/bsearch.3:116 build/C/man3/hsearch.3:323
271 #: build/C/man3/lsearch.3:71 build/C/man3/qsort.3:153
272 #: build/C/man3/tsearch.3:258
273 #, no-wrap
274 msgid "SEE ALSO"
275 msgstr "関連項目"
276
277 #. type: Plain text
278 #: build/C/man3/bsearch.3:121
279 msgid "B<hsearch>(3), B<lsearch>(3), B<qsort>(3), B<tsearch>(3)"
280 msgstr "B<hsearch>(3), B<lsearch>(3), B<qsort>(3), B<tsearch>(3)"
281
282 #. type: SH
283 #: build/C/man3/bsearch.3:121 build/C/man3/hsearch.3:328
284 #: build/C/man3/insque.3:242 build/C/man3/lsearch.3:75
285 #: build/C/man3/qsort.3:158 build/C/man3/tsearch.3:263
286 #, no-wrap
287 msgid "COLOPHON"
288 msgstr "この文書について"
289
290 #. type: Plain text
291 #: build/C/man3/bsearch.3:128 build/C/man3/hsearch.3:335
292 #: build/C/man3/insque.3:249 build/C/man3/lsearch.3:82
293 #: build/C/man3/qsort.3:165 build/C/man3/tsearch.3:270
294 msgid ""
295 "This page is part of release 3.41 of the Linux I<man-pages> project.  A "
296 "description of the project, and information about reporting bugs, can be "
297 "found at http://www.kernel.org/doc/man-pages/."
298 msgstr ""
299 "この man ページは Linux I<man-pages> プロジェクトのリリース 3.41 の一部\n"
300 "である。プロジェクトの説明とバグ報告に関する情報は\n"
301 "http://www.kernel.org/doc/man-pages/ に書かれている。"
302
303 #. type: TH
304 #: build/C/man3/hsearch.3:35
305 #, no-wrap
306 msgid "HSEARCH"
307 msgstr "HSEARCH"
308
309 #. type: TH
310 #: build/C/man3/hsearch.3:35
311 #, no-wrap
312 msgid "2011-09-10"
313 msgstr "2011-09-10"
314
315 #. type: TH
316 #: build/C/man3/hsearch.3:35 build/C/man3/lsearch.3:25
317 #: build/C/man3/tsearch.3:24
318 #, no-wrap
319 msgid "GNU"
320 msgstr "GNU"
321
322 #. type: Plain text
323 #: build/C/man3/hsearch.3:39
324 msgid ""
325 "hcreate, hdestroy, hsearch, hcreate_r, hdestroy_r, hsearch_r - hash table "
326 "management"
327 msgstr ""
328 "hcreate, hdestroy, hsearch, hcreate_r, hdestroy_r, hsearch_r - ハッシュテーブ"
329 "ルの管理"
330
331 #. type: Plain text
332 #: build/C/man3/hsearch.3:42 build/C/man3/hsearch.3:52
333 #: build/C/man3/insque.3:40 build/C/man3/lsearch.3:31
334 #: build/C/man3/tsearch.3:30 build/C/man3/tsearch.3:47
335 #, no-wrap
336 msgid "B<#include E<lt>search.hE<gt>>\n"
337 msgstr "B<#include E<lt>search.hE<gt>>\n"
338
339 #. type: Plain text
340 #: build/C/man3/hsearch.3:44
341 #, no-wrap
342 msgid "B<int hcreate(size_t >I<nel>B<);>\n"
343 msgstr "B<int hcreate(size_t >I<nel>B<);>\n"
344
345 #. type: Plain text
346 #: build/C/man3/hsearch.3:46
347 #, no-wrap
348 msgid "B<ENTRY *hsearch(ENTRY >I<item>B<, ACTION >I<action>B<);>\n"
349 msgstr "B<ENTRY *hsearch(ENTRY >I<item>B<, ACTION >I<action>B<);>\n"
350
351 #. type: Plain text
352 #: build/C/man3/hsearch.3:48
353 #, no-wrap
354 msgid "B<void hdestroy(void);>\n"
355 msgstr "B<void hdestroy(void);>\n"
356
357 #. type: Plain text
358 #: build/C/man3/hsearch.3:50 build/C/man3/tsearch.3:45
359 #, no-wrap
360 msgid "B<#define _GNU_SOURCE>         /* See feature_test_macros(7) */\n"
361 msgstr "B<#define _GNU_SOURCE>         /* feature_test_macros(7) 参照 */\n"
362
363 #. type: Plain text
364 #: build/C/man3/hsearch.3:54
365 #, no-wrap
366 msgid "B<int hcreate_r(size_t >I<nel>B<, struct hsearch_data *>I<htab>B<);>\n"
367 msgstr "B<int hcreate_r(size_t >I<nel>B<, struct hsearch_data *>I<htab>B<);>\n"
368
369 #. type: Plain text
370 #: build/C/man3/hsearch.3:57
371 #, no-wrap
372 msgid ""
373 "B<int hsearch_r(ENTRY >I<item>B<, ACTION >I<action>B<, ENTRY **>I<retval>B<,>\n"
374 "B<              struct hsearch_data *>I<htab>B<);>\n"
375 msgstr ""
376 "B<int hsearch_r(ENTRY >I<item>B<, ACTION >I<action>B<, ENTRY **>I<retval>B<,>\n"
377 "B<              struct hsearch_data *>I<htab>B<);>\n"
378
379 #. type: Plain text
380 #: build/C/man3/hsearch.3:59
381 #, no-wrap
382 msgid "B<void hdestroy_r(struct hsearch_data *>I<htab>B<);>\n"
383 msgstr "B<void hdestroy_r(struct hsearch_data *>I<htab>B<);>\n"
384
385 #. type: Plain text
386 #: build/C/man3/hsearch.3:69
387 msgid ""
388 "The three functions B<hcreate>(), B<hsearch>(), and B<hdestroy>()  allow the "
389 "caller to create and manage a hash search table containing entries "
390 "consisting of a key (a string) and associated data.  Using these functions, "
391 "only one hash table can be used at a time."
392 msgstr ""
393 "B<hcreate>(), B<hsearch>(), B<hdestroy>()  の 3 つの関数を利用すると、キー "
394 "(文字列) と対応するデータから構成される エントリを格納できるハッシュ検索テー"
395 "ブルを作成、管理することができる。 これらの関数を使って、一度に使用できるのは"
396 "一つのハッシュテーブルだけである。"
397
398 #. type: Plain text
399 #: build/C/man3/hsearch.3:83
400 msgid ""
401 "The three functions B<hcreate_r>(), B<hsearch_r>(), B<hdestroy_r>()  are "
402 "reentrant versions that allow a program to use more than one hash search "
403 "table at the same time.  The last argument, I<htab>, points to a structure "
404 "that describes the table on which the function is to operate.  The "
405 "programmer should treat this structure as opaque (i.e., do not attempt to "
406 "directly access or modify the fields in this structure)."
407 msgstr ""
408 "B<hcreate_r>(), B<hsearch_r>(), B<hdestroy_r>()  の 3 つの関数はリエントラン"
409 "ト版で、これらを利用すると、 一つのプログラムで同時に複数のハッシュテーブルを"
410 "使うことができる。 最後の引き数 I<htab> は関数の操作対象となるテーブルを示す"
411 "構造体へのポインタである。 プログラマはこの構造体をブラックボックスとして扱う"
412 "べきである (つまり、この構造体のフィールドに直接アクセスしたり変更したり しな"
413 "いこと)。"
414
415 #.  e.g., in glibc it is raised to the next higher prime number
416 #. type: Plain text
417 #: build/C/man3/hsearch.3:92
418 msgid ""
419 "First a hash table must be created using B<hcreate>().  The argument I<nel> "
420 "specifies the maximum number of entries in the table.  (This maximum cannot "
421 "be changed later, so choose it wisely.)  The implementation may adjust this "
422 "value upward to improve the performance of the resulting hash table."
423 msgstr ""
424 "最初に、 B<hcreate>()  関数によってハッシュテーブルを作成しなければならな"
425 "い。 引き数 I<nel> でテーブルの最大エントリ数を指定する (この最大値は後で変更"
426 "することはできないので、よく考えて選択すること)。 作成されるハッシュテーブル"
427 "の性能を向上させるために、 関数内部の実装によりこの値は増やされる場合もある。"
428
429 #. type: Plain text
430 #: build/C/man3/hsearch.3:103
431 msgid ""
432 "The B<hcreate_r>()  function performs the same task as B<hcreate>(), but for "
433 "the table described by the structure I<*htab>.  The structure pointed to by "
434 "I<htab> must be zeroed before the first call to B<hcreate_r>()."
435 msgstr ""
436 "B<hcreate_r>()  関数は B<hcreate>()  と同じ動作をするが、構造体 I<*htab> で示"
437 "されるテーブルを対象として動作する。 I<htab> が指し示す構造体は、 "
438 "B<hcreate_r>()  を初めて呼び出す前に 0 で埋めておかなければならない。"
439
440 #. type: Plain text
441 #: build/C/man3/hsearch.3:118
442 msgid ""
443 "The function B<hdestroy>()  frees the memory occupied by the hash table that "
444 "was created by B<hcreate>().  After calling B<hdestroy>()  a new hash table "
445 "can be created using B<hcreate>().  The B<hdestroy_r>()  function performs "
446 "the analogous task for a hash table described by I<*htab>, which was "
447 "previously created using B<hcreate_r>()."
448 msgstr ""
449 "B<hdestroy>()  関数は、 B<hcreate>()  で作成されたハッシュテーブルが占有して"
450 "いたメモリを解放する。 ハッシュテーブルによって占有されていたメモリを解放"
451 "し、 新しいテーブルを作成できるようにする。 B<hdestroy>()  を呼び出すと、その"
452 "後は B<hcreate>()  を使って新しいハッシュテーブルを作成することができる。 "
453 "B<hdestroy_r>()  関数は、同様の処理を、それ以前に B<hcreate_r>()  を使って作"
454 "成した I<*htab> で示されるハッシュテーブルに対して実行する。"
455
456 #. type: Plain text
457 #: build/C/man3/hsearch.3:125
458 msgid ""
459 "The B<hsearch>()  function searches the hash table for an item with the same "
460 "key as I<item> (where \"the same\" is determined using B<strcmp>(3)), and if "
461 "successful returns a pointer to it."
462 msgstr ""
463 "B<hsearch>()  関数は、I<item> と同じキーを持つ項目をハッシュテーブルから 検索"
464 "し、項目が見つかった場合にはその項目へのポインタを返す (「同じ」かどうかは "
465 "B<strcmp>(3)  を使って判定する)。"
466
467 #. type: Plain text
468 #: build/C/man3/hsearch.3:128
469 msgid ""
470 "The argument I<item> is of type I<ENTRY>, which is defined in I<E<lt>search."
471 "hE<gt>> as follows:"
472 msgstr ""
473 "引き数 I<item> は B<ENTRY> 型であり、I<E<lt>search.hE<gt>> の中で 以下のよう"
474 "に定義されている。"
475
476 #. type: Plain text
477 #: build/C/man3/hsearch.3:135
478 #, no-wrap
479 msgid ""
480 "typedef struct entry {\n"
481 "    char *key;\n"
482 "    void *data;\n"
483 "} ENTRY;\n"
484 msgstr ""
485 "typedef struct entry {\n"
486 "    char *key;\n"
487 "    void *data;\n"
488 "} ENTRY;\n"
489
490 #. type: Plain text
491 #: build/C/man3/hsearch.3:141
492 msgid ""
493 "The field I<key> points to a null-terminated string which is the search "
494 "key.  The field I<data> points to data that is associated with that key."
495 msgstr ""
496 "フィールド I<key> は検索キーとなる NULL 終端された文字列を指す。 フィールド "
497 "I<data> は、このキーに対応するデータを指す。"
498
499 #. type: Plain text
500 #: build/C/man3/hsearch.3:160
501 msgid ""
502 "The argument I<action> determines what B<hsearch>()  does after an "
503 "unsuccessful search.  This argument must either have the value B<ENTER>, "
504 "meaning insert a copy of I<item> (and return a pointer to the new hash table "
505 "entry as the function result), or the value B<FIND>, meaning that NULL "
506 "should be returned.  (If I<action> is B<FIND>, then I<data> is ignored.)"
507 msgstr ""
508 "検索が失敗した後の動作は、引き数 I<action> により決まる。 この引き数には "
509 "B<ENTER> か B<FIND> のいずれかの値を指定しなければならない。 B<ENTER> は "
510 "I<item> のコピーを挿入することを (関数の結果として新しいハッシュテーブルエン"
511 "トリへのポインタを返す)、 B<FIND> は NULL を返すことを意味する (I<action> が "
512 "B<FIND> の場合、 I<data> は無視される)。"
513
514 #. type: Plain text
515 #: build/C/man3/hsearch.3:174
516 msgid ""
517 "The B<hsearch_r>()  function is like B<hsearch>()  but operates on the hash "
518 "table described by I<*htab>.  The B<hsearch_r>()  function differs from "
519 "B<hsearch>()  in that a pointer to the found item is returned in I<*retval>, "
520 "rather than as the function result."
521 msgstr ""
522 "B<hsearch_r>()  関数は B<hsearch>()  と同様だが、 I<*htab> で示されるハッシュ"
523 "テーブルに対して処理を行う。 B<hsearch_r>()  関数が B<hsearch>()  と異なるの"
524 "は、見つかった項目へのポインタを、 関数の結果としてではなく、 I<*retval> に格"
525 "納して返す点である。"
526
527 #. type: Plain text
528 #: build/C/man3/hsearch.3:180
529 msgid ""
530 "B<hcreate>()  and B<hcreate_r>()  return nonzero on success.  They return 0 "
531 "on error."
532 msgstr ""
533 "B<hcreate>()  と B<hcreate_r>()  は、成功した場合 0 以外の値を返し、 エラーの"
534 "場合 0 を返す。"
535
536 #. type: Plain text
537 #: build/C/man3/hsearch.3:191
538 msgid ""
539 "On success, B<hsearch>()  returns a pointer to an entry in the hash table.  "
540 "B<hsearch>()  returns NULL on error, that is, if I<action> is B<ENTER> and "
541 "the hash table is full, or I<action> is B<FIND> and I<item> cannot be found "
542 "in the hash table.  B<hsearch_r>()  returns nonzero on success, and 0 on "
543 "error."
544 msgstr ""
545 "成功すると、 B<hsearch>()  は、ハッシュテーブル内のエントリへのポインタを返"
546 "す。 エラーの場合、 B<hsearch>()  は NULL を返す。 エラーとなるのは、 "
547 "I<action> が B<ENTER> でハッシュテーブルがいっぱいの場合か、 I<action> が "
548 "B<FIND> で I<item> がハッシュテーブル内に 見つからない場合である。 "
549 "B<hsearch_r>()  は、成功すると 0 以外を返し、エラーの場合 0 を返す。"
550
551 #. type: SH
552 #: build/C/man3/hsearch.3:191
553 #, no-wrap
554 msgid "ERRORS"
555 msgstr "エラー"
556
557 #. type: Plain text
558 #: build/C/man3/hsearch.3:197
559 msgid ""
560 "B<hcreate_r>()  and B<hdestroy_r>()  can fail for the following reasons:"
561 msgstr ""
562 "B<hcreate_r>()  と B<hdestroy_r>()  は以下の理由で失敗する可能性がある。"
563
564 #. type: TP
565 #: build/C/man3/hsearch.3:197
566 #, no-wrap
567 msgid "B<EINVAL>"
568 msgstr "B<EINVAL>"
569
570 #. type: Plain text
571 #: build/C/man3/hsearch.3:201
572 msgid "I<htab> is NULL."
573 msgstr "I<htab> が NULL である。"
574
575 #. type: Plain text
576 #: build/C/man3/hsearch.3:206
577 msgid "B<hsearch>()  and B<hsearch_r>()  can fail for the following reasons:"
578 msgstr "B<hsearch>()  と B<hsearch_r>()  は以下の理由で失敗する可能性がある。"
579
580 #. type: TP
581 #: build/C/man3/hsearch.3:206
582 #, no-wrap
583 msgid "B<ENOMEM>"
584 msgstr "B<ENOMEM>"
585
586 #. type: Plain text
587 #: build/C/man3/hsearch.3:214
588 msgid ""
589 "I<action> was B<ENTER>, I<key> was not found in the table, and there was no "
590 "room in the table to add a new entry."
591 msgstr ""
592 "I<action> が B<ENTER> で、 I<key> がテーブル内に見つからず、 テーブルに新しい"
593 "エントリを追加する余地がなかった。"
594
595 #. type: TP
596 #: build/C/man3/hsearch.3:214
597 #, no-wrap
598 msgid "B<ESRCH>"
599 msgstr "B<ESRCH>"
600
601 #. type: Plain text
602 #: build/C/man3/hsearch.3:222
603 msgid "I<action> was B<FIND>, and I<key> was not found in the table."
604 msgstr "I<action> が B<FIND> で、 I<key> がテーブル内に見つからなかった。"
605
606 #. type: Plain text
607 #: build/C/man3/hsearch.3:226
608 msgid "POSIX.1-2001 only specifies the B<ENOMEM> error."
609 msgstr "POSIX.1-2001 が規定しているのは、エラー B<ENOMEM> だけである。"
610
611 #. type: Plain text
612 #: build/C/man3/hsearch.3:239
613 msgid ""
614 "The functions B<hcreate>(), B<hsearch>(), and B<hdestroy>()  are from SVr4, "
615 "and are described in POSIX.1-2001.  The functions B<hcreate_r>(), "
616 "B<hsearch_r>(), and B<hdestroy_r>()  are GNU extensions."
617 msgstr ""
618 "関数 B<hcreate>(), B<hsearch>(), B<hdestroy>()  は SVr4 から導入されたもの"
619 "で、POSIX.1-2001 に記述されている。 関数 B<hcreate_r>, B<hsearch_r>, "
620 "B<hdestroy_r> は GNU の拡張である。"
621
622 #. type: SH
623 #: build/C/man3/hsearch.3:239 build/C/man3/insque.3:99
624 #: build/C/man3/qsort.3:102 build/C/man3/tsearch.3:158
625 #, no-wrap
626 msgid "NOTES"
627 msgstr "注意"
628
629 #. type: Plain text
630 #: build/C/man3/hsearch.3:246
631 msgid ""
632 "Hash table implementations are usually more efficient when the table "
633 "contains enough free space to minimize collisions.  Typically, this means "
634 "that I<nel> should be at least 25% larger than the maximum number of "
635 "elements that the caller expects to store in the table."
636 msgstr ""
637 "通常、ハッシュテーブルの実装は、衝突を最小限にするために テーブルに十分な空き"
638 "領域がある場合に効率がよくなる。 このため、普通は、 I<nel> を、呼び出し側が"
639 "テーブルに格納しようと思っている エントリの最大数より少なくとも 25% は大きな"
640 "値にすべきである。"
641
642 #. type: Plain text
643 #: build/C/man3/hsearch.3:264
644 msgid ""
645 "The B<hdestroy>()  and B<hdestroy_r>()  functions do not free the buffers "
646 "pointed to by the I<key> and I<data> elements of the hash table entries.  "
647 "(It can't do this because it doesn't know whether these buffers were "
648 "allocated dynamically.)  If these buffers need to be freed (perhaps because "
649 "the program is repeatedly creating and destroying hash tables, rather than "
650 "creating a single table whose lifetime matches that of the program), then "
651 "the program must maintain bookkeeping data structures that allow it to free "
652 "them."
653 msgstr ""
654 "B<hdestroy>()  と B<hdestroy_r>()  は、ハッシュテーブルのエントリの要素であ"
655 "る I<key> と I<data> が指すバッファを解放しない (これができないのは、これらの"
656 "バッファが動的に割り当てられたのかを 知ることができないからである)。 これらの"
657 "バッファを解放する必要がある場合、 プログラムでは、これらのバッファを解放でき"
658 "るように管理用のデータ構造を 設けて、これを管理しなければならない (解放が必要"
659 "となる理由は、たいていは、プログラム自身と生存期間が同じ ハッシュテーブルを一"
660 "つだけ作成するのではなく、そのプログラムでは複数の ハッシュテーブルを繰り返し"
661 "て作成したり破棄したりするからであろう)。"
662
663 #. type: SH
664 #: build/C/man3/hsearch.3:264 build/C/man3/insque.3:125
665 #: build/C/man3/lsearch.3:69
666 #, no-wrap
667 msgid "BUGS"
668 msgstr "バグ"
669
670 #. type: Plain text
671 #: build/C/man3/hsearch.3:271
672 msgid ""
673 "SVr4 and POSIX.1-2001 specify that I<action> is significant only for "
674 "unsuccessful searches, so that an B<ENTER> should not do anything for a "
675 "successful search.  In libc and glibc (before version 2.3), the "
676 "implementation violates the specification, updating the I<data> for the "
677 "given I<key> in this case."
678 msgstr ""
679 "SVr4 と POSIX.1-2001 の規定では、 I<action> は検索が失敗したときにだけ意味を"
680 "持つとなっている。 よって、検索が成功した場合、I<action> の値が B<ENTER> で"
681 "も 何もすべきではない。 (バージョン 2.3 より前の) libc と glibc の実装はこの"
682 "規格に違反しており、 この状況で、指定された I<key> に対応する I<data> が更新"
683 "される。"
684
685 #. type: Plain text
686 #: build/C/man3/hsearch.3:273
687 msgid "Individual hash table entries can be added, but not deleted."
688 msgstr "ハッシュテーブルエントリーの追加はできるが、削除ができない。"
689
690 #. type: Plain text
691 #: build/C/man3/hsearch.3:277
692 msgid ""
693 "The following program inserts 24 items into a hash table, then prints some "
694 "of them."
695 msgstr ""
696 "次のプログラムは、ハッシュテーブルに 24 個の項目を挿入し、 それからそのうちの"
697 "いくつかを表示する。"
698
699 #. type: Plain text
700 #: build/C/man3/hsearch.3:282
701 #, no-wrap
702 msgid ""
703 "#include E<lt>stdio.hE<gt>\n"
704 "#include E<lt>stdlib.hE<gt>\n"
705 "#include E<lt>search.hE<gt>\n"
706 msgstr ""
707 "#include E<lt>stdio.hE<gt>\n"
708 "#include E<lt>stdlib.hE<gt>\n"
709 "#include E<lt>search.hE<gt>\n"
710
711 #. type: Plain text
712 #: build/C/man3/hsearch.3:289
713 #, no-wrap
714 msgid ""
715 "char *data[] = { \"alpha\", \"bravo\", \"charlie\", \"delta\",\n"
716 "     \"echo\", \"foxtrot\", \"golf\", \"hotel\", \"india\", \"juliet\",\n"
717 "     \"kilo\", \"lima\", \"mike\", \"november\", \"oscar\", \"papa\",\n"
718 "     \"quebec\", \"romeo\", \"sierra\", \"tango\", \"uniform\",\n"
719 "     \"victor\", \"whisky\", \"x-ray\", \"yankee\", \"zulu\"\n"
720 "};\n"
721 msgstr ""
722 "char *data[] = { \"alpha\", \"bravo\", \"charlie\", \"delta\",\n"
723 "     \"echo\", \"foxtrot\", \"golf\", \"hotel\", \"india\", \"juliet\",\n"
724 "     \"kilo\", \"lima\", \"mike\", \"november\", \"oscar\", \"papa\",\n"
725 "     \"quebec\", \"romeo\", \"sierra\", \"tango\", \"uniform\",\n"
726 "     \"victor\", \"whisky\", \"x-ray\", \"yankee\", \"zulu\"\n"
727 "};\n"
728
729 #. type: Plain text
730 #: build/C/man3/hsearch.3:295
731 #, no-wrap
732 msgid ""
733 "int\n"
734 "main(void)\n"
735 "{\n"
736 "    ENTRY e, *ep;\n"
737 "    int i;\n"
738 msgstr ""
739 "int main()\n"
740 "{\n"
741 "    ENTRY e, *ep;\n"
742 "    int i;\n"
743
744 #. type: Plain text
745 #: build/C/man3/hsearch.3:297
746 #, no-wrap
747 msgid "    hcreate(30);\n"
748 msgstr "    hcreate(30);\n"
749
750 #. type: Plain text
751 #: build/C/man3/hsearch.3:310
752 #, no-wrap
753 msgid ""
754 "    for (i = 0; i E<lt> 24; i++) {\n"
755 "        e.key = data[i];\n"
756 "        /* data is just an integer, instead of a\n"
757 "           pointer to something */\n"
758 "        e.data = (void *) i;\n"
759 "        ep = hsearch(e, ENTER);\n"
760 "        /* there should be no failures */\n"
761 "        if (ep == NULL) {\n"
762 "            fprintf(stderr, \"entry failed\\en\");\n"
763 "            exit(EXIT_FAILURE);\n"
764 "        }\n"
765 "    }\n"
766 msgstr ""
767 "    for (i = 0; i E<lt> 24; i++) {\n"
768 "        e.key = data[i];\n"
769 "        /* データは、ポインタではなく、単なる整数値である。 */\n"
770 "        e.data = (void *) i;\n"
771 "        ep = hsearch(e, ENTER);\n"
772 "        /* エラーは起こらないはずである。 */\n"
773 "        if (ep == NULL) {\n"
774 "            fprintf(stderr, \"entry failed\\en\");\n"
775 "            exit(EXIT_FAILURE);\n"
776 "        }\n"
777 "    }\n"
778
779 #. type: Plain text
780 #: build/C/man3/hsearch.3:322
781 #, no-wrap
782 msgid ""
783 "    for (i = 22; i E<lt> 26; i++) {\n"
784 "        /* print two entries from the table, and\n"
785 "           show that two are not in the table */\n"
786 "        e.key = data[i];\n"
787 "        ep = hsearch(e, FIND);\n"
788 "        printf(\"%9.9s -E<gt> %9.9s:%d\\en\", e.key,\n"
789 "               ep ? ep-E<gt>key : \"NULL\", ep ? (int)(ep-E<gt>data) : 0);\n"
790 "    }\n"
791 "    hdestroy();\n"
792 "    exit(EXIT_SUCCESS);\n"
793 "}\n"
794 msgstr ""
795 "    for (i = 22; i E<lt> 26; i++) {\n"
796 "        /* テーブルにある 2 つのエントリを表示し、\n"
797 "           あとの 2 つがテーブルにないことを示す。 */\n"
798 "        e.key = data[i];\n"
799 "        ep = hsearch(e, FIND);\n"
800 "        printf(\"%9.9s -E<gt> %9.9s:%d\\en\", e.key,\n"
801 "               ep ? ep-E<gt>key : \"NULL\", ep ? (int)(ep-E<gt>data) : 0);\n"
802 "    }\n"
803 "    hdestroy();\n"
804 "    exit(EXIT_SUCCESS);\n"
805 "}\n"
806
807 #. type: Plain text
808 #: build/C/man3/hsearch.3:328
809 msgid "B<bsearch>(3), B<lsearch>(3), B<malloc>(3), B<tsearch>(3)"
810 msgstr "B<bsearch>(3), B<lsearch>(3), B<malloc>(3), B<tsearch>(3)"
811
812 #. type: TH
813 #: build/C/man3/insque.3:34
814 #, no-wrap
815 msgid "INSQUE"
816 msgstr "INSQUE"
817
818 #. type: TH
819 #: build/C/man3/insque.3:34
820 #, no-wrap
821 msgid "2010-09-09"
822 msgstr "2010-09-09"
823
824 #. type: Plain text
825 #: build/C/man3/insque.3:37
826 msgid "insque, remque - insert/remove an item from a queue"
827 msgstr "insque, remque - キューにアイテムを挿入/削除する"
828
829 #. type: Plain text
830 #: build/C/man3/insque.3:42
831 #, no-wrap
832 msgid "B<void insque(void *>I<elem>B<, void *>I<prev>B<);>\n"
833 msgstr "B<void insque(void *>I<elem>B<, void *>I<prev>B<);>\n"
834
835 #. type: Plain text
836 #: build/C/man3/insque.3:44
837 #, no-wrap
838 msgid "B<void remque(void *>I<elem>B<);>\n"
839 msgstr "B<void remque(void *>I<elem>B<);>\n"
840
841 #. type: Plain text
842 #: build/C/man3/insque.3:49 build/C/man3/qsort.3:53
843 msgid ""
844 "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
845 msgstr "glibc 向けの機能検査マクロの要件 (B<feature_test_macros>(7)  参照):"
846
847 #. type: Plain text
848 #: build/C/man3/insque.3:54
849 msgid "B<insque>(), B<remque>():"
850 msgstr "B<insque>(), B<remque>():"
851
852 #. type: Plain text
853 #: build/C/man3/insque.3:57
854 msgid ""
855 "_SVID_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ "
856 "_XOPEN_SOURCE_EXTENDED"
857 msgstr ""
858 "_SVID_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ "
859 "_XOPEN_SOURCE_EXTENDED"
860
861 #. type: Plain text
862 #: build/C/man3/insque.3:71
863 msgid ""
864 "The B<insque>()  and B<remque>()  functions manipulate doubly-linked lists.  "
865 "Each element in the list is a structure of which the first two elements are "
866 "a forward and a backward pointer.  The linked list may be linear (i.e., NULL "
867 "forward pointer at the end of the list and NULL backward pointer at the "
868 "start of the list)  or circular."
869 msgstr ""
870 "関数 B<insque>() と B<remque>() は双方向連結リスト (doubly-linked list) を\n"
871 "操作する。リスト中のそれぞれの要素は、最初の二つの要素がそれぞれ次と前への\n"
872 "ポインタであるような構造体である。\n"
873 "リンクリストは、線形 (linear) か環状 (circular) のどちらかになる\n"
874 "(線形の場合には、リストの末尾では次へのポインタが NULL になり、\n"
875 "リストの先頭では前へのポインタが NULL になる)。"
876
877 #. type: Plain text
878 #: build/C/man3/insque.3:76
879 msgid ""
880 "The B<insque>()  function inserts the element pointed to by I<elem> "
881 "immediately after the element pointed to by I<prev>."
882 msgstr ""
883 "B<insque>() 関数は I<elem> で示される要素を I<prev> で示される\n"
884 "要素の直後に挿入する。"
885
886 #. type: Plain text
887 #: build/C/man3/insque.3:83
888 msgid ""
889 "If the list is linear, then the call I<insque(elem, NULL)> can be used to "
890 "insert the initial list element, and the call sets the forward and backward "
891 "pointers of I<elem> to NULL."
892 msgstr ""
893 "リストが線形の場合、I<insque(elem, NULL)> を呼び出すと、\n"
894 "リストの最初の要素を挿入することができる。\n"
895 "この呼び出しを行うと I<elem> の次へのポインタと前へのポインタに\n"
896 "共に NULL が設定される。"
897
898 #. type: Plain text
899 #: build/C/man3/insque.3:92
900 msgid ""
901 "If the list is circular, the caller should ensure that the forward and "
902 "backward pointers of the first element are initialized to point to that "
903 "element, and the I<prev> argument of the B<insque>()  call should also point "
904 "to the element."
905 msgstr ""
906 "リストが環状の場合、呼び出す側が、最初の要素の次へのポインタと前へのポイン"
907 "タ\n"
908 "が自分自身を指し、また  B<insque>() の呼び出しで I<prev> 引き数が最初の要素\n"
909 "を指すように保証しなければならない。"
910
911 #. type: Plain text
912 #: build/C/man3/insque.3:97
913 msgid ""
914 "The B<remque>()  function removes the element pointed to by I<elem> from the "
915 "doubly-linked list."
916 msgstr ""
917 "B<remque>() 関数は I<elem> で示される要素を双方向連結リストから取り除く。"
918
919 #. type: Plain text
920 #: build/C/man3/insque.3:99
921 msgid "POSIX.1-2001."
922 msgstr "POSIX.1-2001."
923
924 #. type: Plain text
925 #: build/C/man3/insque.3:103
926 msgid ""
927 "Traditionally (e.g., SunOS, Linux libc 4 and libc 5), the arguments of these "
928 "functions were of type I<struct qelem *>, defined as:"
929 msgstr ""
930 "伝統的に (SunOS, Linux libc 4,5 では) これらの関数の引数は I<struct qelem *>"
931 "型であり、これは以下のように定義されている。"
932
933 #. type: Plain text
934 #: build/C/man3/insque.3:111
935 #, no-wrap
936 msgid ""
937 "struct qelem {\n"
938 "    struct qelem *q_forw;\n"
939 "    struct qelem *q_back;\n"
940 "    char          q_data[1];\n"
941 "};\n"
942 msgstr ""
943 "struct qelem {\n"
944 "    struct qelem *q_forw;\n"
945 "    struct qelem *q_back;\n"
946 "    char          q_data[1];\n"
947 "};\n"
948
949 #. type: Plain text
950 #: build/C/man3/insque.3:118
951 msgid ""
952 "This is still what you will get if B<_GNU_SOURCE> is defined before "
953 "including I<E<lt>search.hE<gt>>."
954 msgstr ""
955 "この定義は I<E<lt>search.hE<gt>> をインクルードする前に B<_GNU_SOURCE> を定義"
956 "することで得られる。"
957
958 #. type: Plain text
959 #: build/C/man3/insque.3:125
960 msgid ""
961 "The location of the prototypes for these functions differs among several "
962 "versions of UNIX.  The above is the POSIX version.  Some systems place them "
963 "in I<E<lt>string.hE<gt>>.  Linux libc4 and libc 5 placed them in "
964 "I<E<lt>stdlib.hE<gt>>."
965 msgstr ""
966 "これらの関数のプロトタイプの置かれる場所は、UNIX の種類により異なる。\n"
967 "上記は POSIX 版である。 I<E<lt>string.hE<gt>> にあるシステムもある。\n"
968 "Linux libc4 と libc5 ではプロトタイプは I<E<lt>stdlib.hE<gt>> に置かれてい"
969 "る。"
970
971 #. type: Plain text
972 #: build/C/man3/insque.3:132
973 msgid ""
974 "In glibc 2.4 and earlier, it was not possible to specify I<prev> as NULL.  "
975 "Consequently, to build a linear list, the caller had to build a list using "
976 "an initial call that contained the first two elements of the list, with the "
977 "forward and backward pointers in each element suitably initialized."
978 msgstr ""
979 "glibc 2.4 以前では I<prev> に NULL を指定することができなかった。\n"
980 "その結果、線形のリストを作成するためには、\n"
981 "呼び出し側は、最初の呼び出しで、リストの最初の 2 つの要素を持ち、\n"
982 "各要素の次へのポインタと前へのポインタを適切に初期化したリストを\n"
983 "作成しなければならなかった。"
984
985 #. type: Plain text
986 #: build/C/man3/insque.3:136
987 msgid ""
988 "The program below demonstrates the use of B<insque>().  Here is an example "
989 "run of the program:"
990 msgstr ""
991 "次のプログラムは B<insque>() の使用法を示したものである。\n"
992 "下記はプログラムの実行例である。"
993
994 #. type: Plain text
995 #: build/C/man3/insque.3:145
996 #, no-wrap
997 msgid ""
998 "$ B<./a.out -c a b c>\n"
999 "Traversing completed list:\n"
1000 "    a\n"
1001 "    b\n"
1002 "    c\n"
1003 "That was a circular list\n"
1004 msgstr ""
1005 "$ B<./a.out -c a b c>\n"
1006 "Traversing completed list:\n"
1007 "    a\n"
1008 "    b\n"
1009 "    c\n"
1010 "That was a circular list\n"
1011
1012 #. type: SS
1013 #: build/C/man3/insque.3:147
1014 #, no-wrap
1015 msgid "Program source"
1016 msgstr "プログラムのソース"
1017
1018 #. type: Plain text
1019 #: build/C/man3/insque.3:154
1020 #, no-wrap
1021 msgid ""
1022 "#include E<lt>stdio.hE<gt>\n"
1023 "#include E<lt>stdlib.hE<gt>\n"
1024 "#include E<lt>unistd.hE<gt>\n"
1025 "#include E<lt>search.hE<gt>\n"
1026 msgstr ""
1027 "#include E<lt>stdio.hE<gt>\n"
1028 "#include E<lt>stdlib.hE<gt>\n"
1029 "#include E<lt>unistd.hE<gt>\n"
1030 "#include E<lt>search.hE<gt>\n"
1031
1032 #. type: Plain text
1033 #: build/C/man3/insque.3:160
1034 #, no-wrap
1035 msgid ""
1036 "struct element {\n"
1037 "    struct element *forward;\n"
1038 "    struct element *backward;\n"
1039 "    char *name;\n"
1040 "};\n"
1041 msgstr ""
1042 "struct element {\n"
1043 "    struct element *forward;\n"
1044 "    struct element *backward;\n"
1045 "    char *name;\n"
1046 "};\n"
1047
1048 #. type: Plain text
1049 #: build/C/man3/insque.3:165
1050 #, no-wrap
1051 msgid ""
1052 "static struct element *\n"
1053 "new_element(void)\n"
1054 "{\n"
1055 "    struct element *e;\n"
1056 msgstr ""
1057 "static struct element *\n"
1058 "new_element(void)\n"
1059 "{\n"
1060 "    struct element *e;\n"
1061
1062 #. type: Plain text
1063 #: build/C/man3/insque.3:171
1064 #, no-wrap
1065 msgid ""
1066 "    e = malloc(sizeof(struct element));\n"
1067 "    if (e == NULL) {\n"
1068 "        fprintf(stderr, \"malloc() failed\\en\");\n"
1069 "        exit(EXIT_FAILURE);\n"
1070 "    }\n"
1071 msgstr ""
1072 "    e = malloc(sizeof(struct element));\n"
1073 "    if (e == NULL) {\n"
1074 "        fprintf(stderr, \"malloc() failed\\en\");\n"
1075 "        exit(EXIT_FAILURE);\n"
1076 "    }\n"
1077
1078 #. type: Plain text
1079 #: build/C/man3/insque.3:174
1080 #, no-wrap
1081 msgid ""
1082 "    return e;\n"
1083 "}\n"
1084 msgstr ""
1085 "    return e;\n"
1086 "}\n"
1087
1088 #. type: Plain text
1089 #: build/C/man3/insque.3:180
1090 #, no-wrap
1091 msgid ""
1092 "int\n"
1093 "main(int argc, char *argv[])\n"
1094 "{\n"
1095 "    struct element *first, *elem, *prev;\n"
1096 "    int circular, opt, errfnd;\n"
1097 msgstr ""
1098 "int\n"
1099 "main(int argc, char *argv[])\n"
1100 "{\n"
1101 "    struct element *first, *elem, *prev;\n"
1102 "    int circular, opt, errfnd;\n"
1103
1104 #. type: Plain text
1105 #: build/C/man3/insque.3:183
1106 #, no-wrap
1107 msgid ""
1108 "    /* The \"-c\" command-line option can be used to specify that the\n"
1109 "       list is circular */\n"
1110 msgstr ""
1111 "    /* The \"-c\" command-line option can be used to specify that the\n"
1112 "       list is circular */\n"
1113
1114 #. type: Plain text
1115 #: build/C/man3/insque.3:196
1116 #, no-wrap
1117 msgid ""
1118 "    errfnd = 0;\n"
1119 "    circular = 0;\n"
1120 "    while ((opt = getopt(argc, argv, \"c\")) != -1) {\n"
1121 "        switch (opt) {\n"
1122 "        case 'c':\n"
1123 "            circular = 1;\n"
1124 "            break;\n"
1125 "        default:\n"
1126 "            errfnd = 1;\n"
1127 "            break;\n"
1128 "        }\n"
1129 "    }\n"
1130 msgstr ""
1131 "    errfnd = 0;\n"
1132 "    circular = 0;\n"
1133 "    while ((opt = getopt(argc, argv, \"c\")) != -1) {\n"
1134 "        switch (opt) {\n"
1135 "        case 'c':\n"
1136 "            circular = 1;\n"
1137 "            break;\n"
1138 "        default:\n"
1139 "            errfnd = 1;\n"
1140 "            break;\n"
1141 "        }\n"
1142 "    }\n"
1143
1144 #. type: Plain text
1145 #: build/C/man3/insque.3:201
1146 #, no-wrap
1147 msgid ""
1148 "    if (errfnd || optind E<gt>= argc) {\n"
1149 "        fprintf(stderr,  \"Usage: %s [-c] string...\\en\", argv[0]);\n"
1150 "        exit(EXIT_FAILURE);\n"
1151 "    }\n"
1152 msgstr ""
1153 "    if (errfnd || optind E<gt>= argc) {\n"
1154 "        fprintf(stderr,  \"Usage: %s [-c] string...\\en\", argv[0]);\n"
1155 "        exit(EXIT_FAILURE);\n"
1156 "    }\n"
1157
1158 #. type: Plain text
1159 #: build/C/man3/insque.3:203
1160 #, no-wrap
1161 msgid "    /* Create first element and place it in the linked list */\n"
1162 msgstr "    /* Create first element and place it in the linked list */\n"
1163
1164 #. type: Plain text
1165 #: build/C/man3/insque.3:206
1166 #, no-wrap
1167 msgid ""
1168 "    elem = new_element();\n"
1169 "    first = elem;\n"
1170 msgstr ""
1171 "    elem = new_element();\n"
1172 "    first = elem;\n"
1173
1174 #. type: Plain text
1175 #: build/C/man3/insque.3:208
1176 #, no-wrap
1177 msgid "    elem-E<gt>name = argv[optind];\n"
1178 msgstr "    elem-E<gt>name = argv[optind];\n"
1179
1180 #. type: Plain text
1181 #: build/C/man3/insque.3:216
1182 #, no-wrap
1183 msgid ""
1184 "    if (circular) {\n"
1185 "        elem-E<gt>forward = elem;\n"
1186 "        elem-E<gt>backward = elem;\n"
1187 "        insque(elem, elem);\n"
1188 "    } else {\n"
1189 "        insque(elem, NULL);\n"
1190 "    }\n"
1191 msgstr ""
1192 "    if (circular) {\n"
1193 "        elem-E<gt>forward = elem;\n"
1194 "        elem-E<gt>backward = elem;\n"
1195 "        insque(elem, elem);\n"
1196 "    } else {\n"
1197 "        insque(elem, NULL);\n"
1198 "    }\n"
1199
1200 #. type: Plain text
1201 #: build/C/man3/insque.3:218
1202 #, no-wrap
1203 msgid "    /* Add remaining command-line arguments as list elements */\n"
1204 msgstr "    /* Add remaining command-line arguments as list elements */\n"
1205
1206 #. type: Plain text
1207 #: build/C/man3/insque.3:221
1208 #, no-wrap
1209 msgid ""
1210 "    while (++optind E<lt> argc) {\n"
1211 "        prev = elem;\n"
1212 msgstr ""
1213 "    while (++optind E<lt> argc) {\n"
1214 "        prev = elem;\n"
1215
1216 #. type: Plain text
1217 #: build/C/man3/insque.3:226
1218 #, no-wrap
1219 msgid ""
1220 "        elem = new_element();\n"
1221 "        elem-E<gt>name = argv[optind];\n"
1222 "        insque(elem, prev);\n"
1223 "    }\n"
1224 msgstr ""
1225 "        elem = new_element();\n"
1226 "        elem-E<gt>name = argv[optind];\n"
1227 "        insque(elem, prev);\n"
1228 "    }\n"
1229
1230 #. type: Plain text
1231 #: build/C/man3/insque.3:228
1232 #, no-wrap
1233 msgid "    /* Traverse the list from the start, printing element names */\n"
1234 msgstr "    /* Traverse the list from the start, printing element names */\n"
1235
1236 #. type: Plain text
1237 #: build/C/man3/insque.3:235
1238 #, no-wrap
1239 msgid ""
1240 "    printf(\"Traversing completed list:\\en\");\n"
1241 "    elem = first;\n"
1242 "    do {\n"
1243 "        printf(\"    %s\\en\", elem-E<gt>name);\n"
1244 "        elem = elem-E<gt>forward;\n"
1245 "    } while (elem != NULL && elem != first);\n"
1246 msgstr ""
1247 "    printf(\"Traversing completed list:\\en\");\n"
1248 "    elem = first;\n"
1249 "    do {\n"
1250 "        printf(\"    %s\\en\", elem-E<gt>name);\n"
1251 "        elem = elem-E<gt>forward;\n"
1252 "    } while (elem != NULL && elem != first);\n"
1253
1254 #. type: Plain text
1255 #: build/C/man3/insque.3:238
1256 #, no-wrap
1257 msgid ""
1258 "    if (elem == first)\n"
1259 "        printf(\"That was a circular list\\en\");\n"
1260 msgstr ""
1261 "    if (elem == first)\n"
1262 "        printf(\"That was a circular list\\en\");\n"
1263
1264 #. type: Plain text
1265 #: build/C/man3/insque.3:241
1266 #, no-wrap
1267 msgid ""
1268 "    exit(EXIT_SUCCESS);\n"
1269 "}\n"
1270 msgstr ""
1271 "    exit(EXIT_SUCCESS);\n"
1272 "}\n"
1273
1274 #. type: TH
1275 #: build/C/man3/lsearch.3:25
1276 #, no-wrap
1277 msgid "LSEARCH"
1278 msgstr "LSEARCH"
1279
1280 #. type: TH
1281 #: build/C/man3/lsearch.3:25
1282 #, no-wrap
1283 msgid "1999-09-27"
1284 msgstr "1999-09-27"
1285
1286 #. type: Plain text
1287 #: build/C/man3/lsearch.3:28
1288 msgid "lfind, lsearch - linear search of an array"
1289 msgstr "lfind, lsearch - 配列を線形検索する"
1290
1291 #. type: Plain text
1292 #: build/C/man3/lsearch.3:34
1293 #, no-wrap
1294 msgid ""
1295 "B<void *lfind(const void *>I<key>B<, const void *>I<base>B<, size_t *>I<nmemb>B<,>\n"
1296 "B<         size_t >I<size>B<, int(*>I<compar>B<)(const void *, const void *));>\n"
1297 msgstr ""
1298 "B<void *lfind(const void *>I<key>B<, const void *>I<base>B<, size_t *>I<nmemb>B<,>\n"
1299 "B<         size_t >I<size>B<, int(*>I<compar>B<)(const void *, const void *));>\n"
1300
1301 #. type: Plain text
1302 #: build/C/man3/lsearch.3:37
1303 #, no-wrap
1304 msgid ""
1305 "B<void *lsearch(const void *>I<key>B<, void *>I<base>B<, size_t *>I<nmemb>B<,>\n"
1306 "B<         size_t >I<size>B<, int(*>I<compar>B<)(const void *, const void *));>\n"
1307 msgstr ""
1308 "B<void *lsearch(const void *>I<key>B<, void *>I<base>B<, size_t *>I<nmemb>B<,>\n"
1309 "B<         size_t >I<size>B<, int(*>I<compar>B<)(const void *, const void *));>\n"
1310
1311 #. type: Plain text
1312 #: build/C/man3/lsearch.3:50
1313 msgid ""
1314 "B<lfind>()  and B<lsearch>()  perform a linear search for I<key> in the "
1315 "array I<base> which has I<*nmemb> elements of I<size> bytes each.  The "
1316 "comparison function referenced by I<compar> is expected to have two "
1317 "arguments which point to the I<key> object and to an array member, in that "
1318 "order, and which returns zero if the I<key> object matches the array member, "
1319 "and nonzero otherwise."
1320 msgstr ""
1321 "B<lfind>()  と B<lsearch>()  は、 I<size> バイトの要素 I<*nmemb> 個からなる配"
1322 "列 I<base> から、 I<key> を線形検索する。比較を行うのは I<compar> が参照して"
1323 "いる関数で、 これは 2つの引き数を持ち、1つめの引き数が I<key> を、2つめの引き"
1324 "数は配列メンバーを指す。また I<compar> は、 I<key> が配列のメンバーとマッチし"
1325 "たなら 0、そうでなければ 0 以外を返すことが期待されている。"
1326
1327 #. type: Plain text
1328 #: build/C/man3/lsearch.3:58
1329 msgid ""
1330 "If B<lsearch>()  does not find a matching element, then the I<key> object is "
1331 "inserted at the end of the table, and I<*nmemb> is incremented.  In "
1332 "particular, one should know that a matching element exists, or that more "
1333 "room is available."
1334 msgstr ""
1335 "B<lsearch>()  は、マッチする要素を見つけられなかったとき、 配列の最後に "
1336 "I<key> をつけ加える。そして I<*nmemb> を 1 ふやす。 したがって、この関数を使"
1337 "用する際には、マッチする要素が存在するか、 もしくは配列に要素を追加するための"
1338 "領域があるか、を把握しておく必要がある。"
1339
1340 #. type: Plain text
1341 #: build/C/man3/lsearch.3:66
1342 msgid ""
1343 "B<lfind>()  returns a pointer to a matching member of the array, or NULL if "
1344 "no match is found.  B<lsearch>()  returns a pointer to a matching member of "
1345 "the array, or to the newly added member if no match is found."
1346 msgstr ""
1347 "B<lfind>()  の返り値は、配列のマッチしたメンバーへのポインタである。 もしマッ"
1348 "チするメンバーが見つからないと NULL を返す。 B<lsearch>()  の返り値も、配列の"
1349 "マッチしたメンバーへのポインタである。 マッチするメンバーが見つからなかったと"
1350 "きは、 新たにつけ加えたメンバーへのポインタを返す。"
1351
1352 #. type: Plain text
1353 #: build/C/man3/lsearch.3:69
1354 msgid "SVr4, 4.3BSD, POSIX.1-2001.  Present in libc since libc-4.6.27."
1355 msgstr ""
1356 "SVr4, 4.3BSD, POSIX.1-2001.  libc には libc-4.6.27 以降で実装されている。"
1357
1358 #. type: Plain text
1359 #: build/C/man3/lsearch.3:71
1360 msgid "The naming is unfortunate."
1361 msgstr "関数の名前の選び方がよくない。"
1362
1363 #. type: Plain text
1364 #: build/C/man3/lsearch.3:75
1365 msgid "B<bsearch>(3), B<hsearch>(3), B<tsearch>(3)"
1366 msgstr "B<bsearch>(3), B<hsearch>(3), B<tsearch>(3)"
1367
1368 #. type: TH
1369 #: build/C/man3/qsort.3:35
1370 #, no-wrap
1371 msgid "QSORT"
1372 msgstr "QSORT"
1373
1374 #. type: TH
1375 #: build/C/man3/qsort.3:35
1376 #, no-wrap
1377 msgid "2012-03-08"
1378 msgstr "2012-03-08"
1379
1380 #. type: Plain text
1381 #: build/C/man3/qsort.3:38
1382 msgid "qsort, qsort_r - sort an array"
1383 msgstr "qsort, qsort_r - 配列を並べ変える"
1384
1385 #. type: Plain text
1386 #: build/C/man3/qsort.3:44
1387 #, no-wrap
1388 msgid ""
1389 "B<void qsort(void *>I<base>B<, size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
1390 "B<           int (*>I<compar>B<)(const void *, const void *));>\n"
1391 msgstr ""
1392 "B<void qsort(void *>I<base>B<, size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
1393 "B<           int (*>I<compar>B<)(const void *, const void *));>\n"
1394
1395 #. type: Plain text
1396 #: build/C/man3/qsort.3:48
1397 #, no-wrap
1398 msgid ""
1399 "B<void qsort_r(void *>I<base>B<, size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
1400 "B<           int (*>I<compar>B<)(const void *, const void *, void *),>\n"
1401 "B<           void *>I<arg>B<);>\n"
1402 msgstr ""
1403 "B<void qsort_r(void *>I<base>B<, size_t >I<nmemb>B<, size_t >I<size>B<,>\n"
1404 "B<           int (*>I<compar>B<)(const void *, const void *, void *),>\n"
1405 "B<           void *>I<arg>B<);>\n"
1406
1407 #. type: Plain text
1408 #: build/C/man3/qsort.3:58
1409 msgid "B<qsort_r>(): _GNU_SOURCE"
1410 msgstr "B<qsort_r>(): _GNU_SOURCE"
1411
1412 #. type: Plain text
1413 #: build/C/man3/qsort.3:66
1414 msgid ""
1415 "The B<qsort>()  function sorts an array with I<nmemb> elements of size "
1416 "I<size>.  The I<base> argument points to the start of the array."
1417 msgstr ""
1418 "B<qsort>()  関数は、 I<nmemb> 個の大きさ I<size> の要素をもつ配列を並べ変え"
1419 "る。 I<base> 引き数は配列の先頭へのポインタである。"
1420
1421 #. type: Plain text
1422 #: build/C/man3/qsort.3:70
1423 msgid ""
1424 "The contents of the array are sorted in ascending order according to a "
1425 "comparison function pointed to by I<compar>, which is called with two "
1426 "arguments that point to the objects being compared."
1427 msgstr ""
1428 "I<compar> をポインタとする比較関数によって、 配列の中身は昇順 (値の大きいもの"
1429 "ほど後に並ぶ順番) に並べられる。 比較関数の引き数は比較されるふたつのオブジェ"
1430 "クトのポインタである。"
1431
1432 #. type: Plain text
1433 #: build/C/man3/qsort.3:76
1434 msgid ""
1435 "The comparison function must return an integer less than, equal to, or "
1436 "greater than zero if the first argument is considered to be respectively "
1437 "less than, equal to, or greater than the second.  If two members compare as "
1438 "equal, their order in the sorted array is undefined."
1439 msgstr ""
1440 "比較関数は、第一引き数が第二引き数に対して、 1) 小さい、2) 等しい、3) 大きい"
1441 "のそれぞれに応じて、 1) ゼロより小さい整数、2) ゼロ、3) ゼロより大きい整数の "
1442 "いずれかを返さなければならない。 二つの要素の比較結果が等しいとき、 並べ変え"
1443 "た後の配列では、これら二つの順序は規定されていない。"
1444
1445 #. type: Plain text
1446 #: build/C/man3/qsort.3:89
1447 msgid ""
1448 "The B<qsort_r>()  function is identical to B<qsort>()  except that the "
1449 "comparison function I<compar> takes a third argument.  A pointer is passed "
1450 "to the comparison function via I<arg>.  In this way, the comparison function "
1451 "does not need to use global variables to pass through arbitrary arguments, "
1452 "and is therefore reentrant and safe to use in threads."
1453 msgstr ""
1454 "B<qsort_r>() 関数は B<qsort>() と同じだが、比較関数 I<compar> が第 3 引き数"
1455 "を\n"
1456 "取る点が異なる。ポインタが I<arg> 経由で比較関数に渡される。\n"
1457 "これにより、比較関数は任意の引き数を渡すためにグローバル変数を使う必要がなく"
1458 "なり、\n"
1459 "そのため、リエントラント (再入可能) で安全にスレッドで使用できるようになる。"
1460
1461 #. type: Plain text
1462 #: build/C/man3/qsort.3:95
1463 msgid "The B<qsort>()  and B<qsort_r>()  functions return no value."
1464 msgstr "関数 B<qsort>() と B<qsort_r>() は値を返さない。"
1465
1466 #. type: SH
1467 #: build/C/man3/qsort.3:95
1468 #, no-wrap
1469 msgid "VERSIONS"
1470 msgstr "バージョン"
1471
1472 #. type: Plain text
1473 #: build/C/man3/qsort.3:98
1474 msgid "B<qsort_r>()  was added to glibc in version 2.8."
1475 msgstr "B<qsort_r>() は glibc バージョン 2.8 で追加された。"
1476
1477 #. type: Plain text
1478 #: build/C/man3/qsort.3:102
1479 msgid "The B<qsort>()  function conforms to SVr4, 4.3BSD, C89, C99."
1480 msgstr "B<qsort>() 関数は SVr4, 4.3BSD, C89, C99 に準拠している。"
1481
1482 #. type: Plain text
1483 #: build/C/man3/qsort.3:114
1484 msgid ""
1485 "Library routines suitable for use as the I<compar> argument to B<qsort>()  "
1486 "include B<alphasort>(3)  and B<versionsort>(3).  To compare C strings, the "
1487 "comparison function can call B<strcmp>(3), as shown in the example below."
1488 msgstr ""
1489 "B<qsort>() の I<compar> 引き数に使用するのに適しているライブラリルーチンと\n"
1490 "しては B<alphasort>(3), B<versionsort>(3) がある。 C の文字列を比較する場"
1491 "合、\n"
1492 "以下の例にあるように比較関数で B<strcmp>(3) を呼び出すこともできる。"
1493
1494 #. type: Plain text
1495 #: build/C/man3/qsort.3:117
1496 msgid "For one example of use, see the example under B<bsearch>(3)."
1497 msgstr "使用例については、 B<bsearch>(3)  にある例を参照すること。"
1498
1499 #. type: Plain text
1500 #: build/C/man3/qsort.3:120
1501 msgid ""
1502 "Another example is the following program, which sorts the strings given in "
1503 "its command-line arguments:"
1504 msgstr ""
1505 "以下のプログラムに別の使用例を示す。このプログラムは、 コマンドライン引き数で"
1506 "指定された文字列の並び換えを行う。"
1507
1508 #. type: Plain text
1509 #: build/C/man3/qsort.3:132
1510 #, no-wrap
1511 msgid ""
1512 "static int\n"
1513 "cmpstringp(const void *p1, const void *p2)\n"
1514 "{\n"
1515 "    /* The actual arguments to this function are \"pointers to\n"
1516 "       pointers to char\", but strcmp(3) arguments are \"pointers\n"
1517 "       to char\", hence the following cast plus dereference */\n"
1518 msgstr ""
1519 "static int\n"
1520 "cmpstringp(const void *p1, const void *p2)\n"
1521 "{\n"
1522 "    /* この関数の実際の引き数は \"char 型へのポインタのポインタ\" だが、\n"
1523 "       strcmp(3) の引き数は \"char 型へのポインタ\" である。\n"
1524 "       そこで、以下のようにキャストをしてからポインタの逆参照を行う。*/\n"
1525
1526 #. type: Plain text
1527 #: build/C/man3/qsort.3:135
1528 #, no-wrap
1529 msgid ""
1530 "    return strcmp(* (char * const *) p1, * (char * const *) p2);\n"
1531 "}\n"
1532 msgstr ""
1533 "    return strcmp(* (char * const *) p1, * (char * const *) p2);\n"
1534 "}\n"
1535
1536 #. type: Plain text
1537 #: build/C/man3/qsort.3:140
1538 #, no-wrap
1539 msgid ""
1540 "int\n"
1541 "main(int argc, char *argv[])\n"
1542 "{\n"
1543 "    int j;\n"
1544 msgstr ""
1545 "int\n"
1546 "main(int argc, char *argv[])\n"
1547 "{\n"
1548 "    int j;\n"
1549
1550 #. type: Plain text
1551 #: build/C/man3/qsort.3:145
1552 #, no-wrap
1553 msgid ""
1554 "    if (argc E<lt> 2) {\n"
1555 "\tfprintf(stderr, \"Usage: %s E<lt>stringE<gt>...\\en\", argv[0]);\n"
1556 "\texit(EXIT_FAILURE);\n"
1557 "    }\n"
1558 msgstr ""
1559 "    if (argc E<lt> 2) {\n"
1560 "\tfprintf(stderr, \"Usage: %s E<lt>stringE<gt>...\\en\", argv[0]);\n"
1561 "\texit(EXIT_FAILURE);\n"
1562 "    }\n"
1563
1564 #. type: Plain text
1565 #: build/C/man3/qsort.3:147
1566 #, no-wrap
1567 msgid "    qsort(&argv[1], argc - 1, sizeof(char *), cmpstringp);\n"
1568 msgstr "    qsort(&argv[1], argc - 1, sizeof(char *), cmpstringp);\n"
1569
1570 #. type: Plain text
1571 #: build/C/man3/qsort.3:152
1572 #, no-wrap
1573 msgid ""
1574 "    for (j = 1; j E<lt> argc; j++)\n"
1575 "        puts(argv[j]);\n"
1576 "    exit(EXIT_SUCCESS);\n"
1577 "}\n"
1578 msgstr ""
1579 "    for (j = 1; j E<lt> argc; j++)\n"
1580 "        puts(argv[j]);\n"
1581 "    exit(EXIT_SUCCESS);\n"
1582 "}\n"
1583
1584 #. type: Plain text
1585 #: build/C/man3/qsort.3:158
1586 msgid "B<sort>(1), B<alphasort>(3), B<strcmp>(3), B<versionsort>(3)"
1587 msgstr "B<sort>(1), B<alphasort>(3), B<strcmp>(3), B<versionsort>(3)"
1588
1589 #. type: TH
1590 #: build/C/man3/tsearch.3:24
1591 #, no-wrap
1592 msgid "TSEARCH"
1593 msgstr "TSEARCH"
1594
1595 #. type: TH
1596 #: build/C/man3/tsearch.3:24
1597 #, no-wrap
1598 msgid "2008-09-23"
1599 msgstr "2008-09-23"
1600
1601 #. type: Plain text
1602 #: build/C/man3/tsearch.3:27
1603 msgid "tsearch, tfind, tdelete, twalk, tdestroy - manage a binary tree"
1604 msgstr "tsearch, tfind, tdelete, twalk, tdestroy - 二分木 (binary tree) の操作"
1605
1606 #. type: Plain text
1607 #: build/C/man3/tsearch.3:33
1608 #, no-wrap
1609 msgid ""
1610 "B<void *tsearch(const void *>I<key>B<, void **>I<rootp>B<,>\n"
1611 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1612 msgstr ""
1613 "B<void *tsearch(const void *>I<key>B<, void **>I<rootp>B<,>\n"
1614 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1615
1616 #. type: Plain text
1617 #: build/C/man3/tsearch.3:36
1618 #, no-wrap
1619 msgid ""
1620 "B<void *tfind(const void *>I<key>B<, const void **>I<rootp>B<,>\n"
1621 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1622 msgstr ""
1623 "B<void *tfind(const void *>I<key>B<, const void **>I<rootp>B<,>\n"
1624 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1625
1626 #. type: Plain text
1627 #: build/C/man3/tsearch.3:39
1628 #, no-wrap
1629 msgid ""
1630 "B<void *tdelete(const void *>I<key>B<, void **>I<rootp>B<,>\n"
1631 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1632 msgstr ""
1633 "B<void *tdelete(const void *>I<key>B<, void **>I<rootp>B<,>\n"
1634 "B<                int (*>I<compar>B<)(const void *, const void *));>\n"
1635
1636 #. type: Plain text
1637 #: build/C/man3/tsearch.3:43
1638 #, no-wrap
1639 msgid ""
1640 "B<void twalk(const void *>I<root>B<, void (*>I<action>B<)(const void *>I<nodep>B<,>\n"
1641 "B<                                   const VISIT >I<which>B<,>\n"
1642 "B<                                   const int >I<depth>B<));>\n"
1643 msgstr ""
1644 "B<void twalk(const void *>I<root>B<, void (*>I<action>B<)(const void *>I<nodep>B<,>\n"
1645 "B<                                   const VISIT >I<which>B<,>\n"
1646 "B<                                   const int >I<depth>B<));>\n"
1647
1648 #. type: Plain text
1649 #: build/C/man3/tsearch.3:49
1650 #, no-wrap
1651 msgid "B<void tdestroy(void *>I<root>B<, void (*>I<free_node>B<)(void *>I<nodep>B<));>\n"
1652 msgstr "B<void tdestroy(void *>I<root>B<, void (*>I<free_node>B<)(void *>I<nodep>B<));>\n"
1653
1654 #. type: Plain text
1655 #: build/C/man3/tsearch.3:67
1656 msgid ""
1657 "B<tsearch>(), B<tfind>(), B<twalk>(), and B<tdelete>()  manage a binary "
1658 "tree.  They are generalized from Knuth (6.2.2) Algorithm T.  The first field "
1659 "in each node of the tree is a pointer to the corresponding data item.  (The "
1660 "calling program must store the actual data.)  I<compar> points to a "
1661 "comparison routine, which takes pointers to two items.  It should return an "
1662 "integer which is negative, zero, or positive, depending on whether the first "
1663 "item is less than, equal to, or greater than the second."
1664 msgstr ""
1665 "B<tsearch>(), B<tfind>(), B<twalk>(), B<tdelete>()  は 二分木を操作する関数で"
1666 "ある。 これらの関数は Knuth (6.2.2) Algorithm T に基づいている。 木構造におけ"
1667 "る各ノードの最初のフィールドは、対応するデータ・ アイテムへのポインタであ"
1668 "る。 (参照先のデータは、呼び出しプログラムで用意する。)  I<compar> は比較ルー"
1669 "チンへのポインタである。 比較ルーチンは、アイテムへのポインタ 2 つを引数に持"
1670 "つ。 比較ルーチンの返り値は、1 つ目のアイテムが 2 つ目のアイテムよりも 「小さ"
1671 "い、等しい、大きい」によって、 「負、0、正」の整数値でなければならない。"
1672
1673 #. type: Plain text
1674 #: build/C/man3/tsearch.3:82
1675 msgid ""
1676 "B<tsearch>()  searches the tree for an item.  I<key> points to the item to "
1677 "be searched for.  I<rootp> points to a variable which points to the root of "
1678 "the tree.  If the tree is empty, then the variable that I<rootp> points to "
1679 "should be set to NULL.  If the item is found in the tree, then B<tsearch>()  "
1680 "returns a pointer to it.  If it is not found, then B<tsearch>()  adds it, "
1681 "and returns a pointer to the newly added item."
1682 msgstr ""
1683 "B<tsearch>()  は、木構造からアイテムを検索する関数である。 I<key> は、検索す"
1684 "るアイテムへのポインタである。 I<rootp> は木構造の根へのポインタへのポインタ"
1685 "である。 木構造がノードを含まない場合、I<rootp> の参照している変数は NULL に"
1686 "設定されていなければならない。 木構造にアイテムが見つかった場合、 B<tsearch>"
1687 "()  はそのアイテムへのポインタを返す。 見つからなかった場合は、アイテムを木構"
1688 "造に追加し、 追加したアイテムへのポインタを返す。"
1689
1690 #. type: Plain text
1691 #: build/C/man3/tsearch.3:90
1692 msgid ""
1693 "B<tfind>()  is like B<tsearch>(), except that if the item is not found, then "
1694 "B<tfind>()  returns NULL."
1695 msgstr ""
1696 "B<tfind>()  は、 B<tsearch>()  に似ているが、 アイテムが見つからなかった場合 "
1697 "NULL を返す点が異なる。"
1698
1699 #. type: Plain text
1700 #: build/C/man3/tsearch.3:95
1701 msgid ""
1702 "B<tdelete>()  deletes an item from the tree.  Its arguments are the same as "
1703 "for B<tsearch>()."
1704 msgstr ""
1705 "B<tdelete>()  は木構造からアイテムを削除する。 引数は B<tsearch>()  と同じで"
1706 "ある。"
1707
1708 #. type: Plain text
1709 #: build/C/man3/tsearch.3:115
1710 msgid ""
1711 "B<twalk>()  performs depth-first, left-to-right traversal of a binary tree.  "
1712 "I<root> points to the starting node for the traversal.  If that node is not "
1713 "the root, then only part of the tree will be visited.  B<twalk>()  calls the "
1714 "user function I<action> each time a node is visited (that is, three times "
1715 "for an internal node, and once for a leaf).  I<action>, in turn, takes three "
1716 "arguments.  The first is a pointer to the node being visited.  The second is "
1717 "an integer which takes on the values B<preorder>, B<postorder>, and "
1718 "B<endorder> depending on whether this is the first, second, or third visit "
1719 "to the internal node, or B<leaf> if it is the single visit to a leaf node.  "
1720 "(These symbols are defined in I<E<lt>search.hE<gt>>.)  The third argument is "
1721 "the depth of the node, with zero being the root."
1722 msgstr ""
1723 "B<twalk>()  は、二分木を深さ優先 (depth-first) で、 左から右にたどっていく関"
1724 "数である。 I<root> は起点となるノードへのポインタである。 I<root> に根以外の"
1725 "ノードを指定すると、部分木が対象となる。 B<twalk>()  は、ノードを訪れる度に "
1726 "(つまり、内部ノードに対しては 3 回、葉に対しては 1 回)  ユーザ関数 I<action> "
1727 "を呼び出す。 I<action> には以下の順に 3 つの引数が与えられる。 最初の引数は訪"
1728 "れたノードへのポインタである。 2 つ目の引数には、内部ノードの場合は訪問回数に"
1729 "応じて B<preorder>, B<postorder>, B<endorder> が、 葉の場合は B<leaf> が与え"
1730 "られる。 (これらのシンボルは I<E<lt>search.hE<gt>> で定義されている。)  3 つ"
1731 "目の引数はノードの深さで、根の場合は 0 である。"
1732
1733 #. type: Plain text
1734 #: build/C/man3/tsearch.3:122
1735 msgid ""
1736 "(More commonly, B<preorder>, B<postorder>, and B<endorder> are known as "
1737 "B<preorder>, B<inorder>, and B<postorder>: before visiting the children, "
1738 "after the first and before the second, and after visiting the children.  "
1739 "Thus, the choice of name B<post\\%order> is rather confusing.)"
1740 msgstr ""
1741 "(より一般的には、B<preorder>, B<postorder>, B<endorder> は B<preorder>, "
1742 "B<inorder>, B<postorder> として知られている: それぞれ、子要素を辿る前・最初の"
1743 "子要素を辿った後かつ 2 番目の子要素を辿る前・ 子要素を辿った後ということを表"
1744 "している。 よって B<post\\%order> という名前を選ぶのは少し紛らわしい。)"
1745
1746 #. type: Plain text
1747 #: build/C/man3/tsearch.3:132
1748 msgid ""
1749 "B<tdestroy>()  removes the whole tree pointed to by I<root>, freeing all "
1750 "resources allocated by the B<tsearch>()  function.  For the data in each "
1751 "tree node the function I<free_node> is called.  The pointer to the data is "
1752 "passed as the argument to the function.  If no such work is necessary "
1753 "I<free_node> must point to a function doing nothing."
1754 msgstr ""
1755 "B<tdestroy>()  は I<root> が指す木構造全体を削除し、 B<tsearch>()  関数で確保"
1756 "されたリソースを全て解放する。 木構造の各ノードについて、関数 I<free_node> が"
1757 "呼び出される。 データへのポインタがこの関数の引数として渡される。 そのような"
1758 "動作が必要でなければ、 I<free_node> は何もしない関数へのポインタでなければな"
1759 "らない。"
1760
1761 #. type: Plain text
1762 #: build/C/man3/tsearch.3:142
1763 msgid ""
1764 "B<tsearch>()  returns a pointer to a matching item in the tree, or to the "
1765 "newly added item, or NULL if there was insufficient memory to add the item.  "
1766 "B<tfind>()  returns a pointer to the item, or NULL if no match is found.  If "
1767 "there are multiple elements that match the key, the element returned is "
1768 "unspecified."
1769 msgstr ""
1770 "B<tsearch>()  は、木構造に見つかったアイテムか、 新しく追加したアイテムへのポ"
1771 "インタを返す。 メモリの不足のためアイテムを追加できなかった場合は NULL を返"
1772 "す。 B<tfind>()  は、アイテムへのポインタを返す。 一致するアイテムが見つから"
1773 "ない場合は NULL を返す。 検索条件に一致する要素が複数ある場合、返される値は不"
1774 "定である。"
1775
1776 #. type: Plain text
1777 #: build/C/man3/tsearch.3:146
1778 msgid ""
1779 "B<tdelete>()  returns a pointer to the parent of the item deleted, or NULL "
1780 "if the item was not found."
1781 msgstr ""
1782 "B<tdelete>()  は削除したアイテムの親へのポインタを返す。 アイテムが見つからな"
1783 "かった場合は NULL を返す。"
1784
1785 #. type: Plain text
1786 #: build/C/man3/tsearch.3:153
1787 msgid ""
1788 "B<tsearch>(), B<tfind>(), and B<tdelete>()  also return NULL if I<rootp> was "
1789 "NULL on entry."
1790 msgstr ""
1791 "I<rootp> が NULL の場合、 B<tsearch>(), B<tfind>(), B<tdelete>()  は NULL を"
1792 "返す。"
1793
1794 #. type: Plain text
1795 #: build/C/man3/tsearch.3:158
1796 msgid "SVr4, POSIX.1-2001.  The function B<tdestroy>()  is a GNU extension."
1797 msgstr "SVr4, POSIX.1-2001.  関数 B<tdestroy>()  は GNU の拡張である。"
1798
1799 #. type: Plain text
1800 #: build/C/man3/tsearch.3:162
1801 msgid ""
1802 "B<twalk>()  takes a pointer to the root, while the other functions take a "
1803 "pointer to a variable which points to the root."
1804 msgstr ""
1805 "B<twalk>()  は根へのポインタを引数にとるが、 ほかの関数は根へのポインタへのポ"
1806 "インタである。"
1807
1808 #. type: Plain text
1809 #: build/C/man3/tsearch.3:168
1810 msgid ""
1811 "B<twalk>()  uses B<postorder> to mean \"after the left subtree, but before "
1812 "the right subtree\".  Some authorities would call this \"inorder\", and "
1813 "reserve \"postorder\" to mean \"after both subtrees\"."
1814 msgstr ""
1815 "B<twalk>()  においては、B<postorder> は 「左の部分木の後で、右の部分木の前」"
1816 "を意味している。 しかし、人によってはこれを \"inorder\" と呼んで、 "
1817 "\"postorder\" を「両方の部分木の後」とする場合もある。"
1818
1819 #. type: Plain text
1820 #: build/C/man3/tsearch.3:173
1821 msgid ""
1822 "B<tdelete>()  frees the memory required for the node in the tree.  The user "
1823 "is responsible for freeing the memory for the corresponding data."
1824 msgstr ""
1825 "B<tdelete>()  は、削除したノードの使用していたメモリを解放するが、 ノードに対"
1826 "応するデータのメモリは、ユーザが解放しなければならない。"
1827
1828 #. type: Plain text
1829 #: build/C/man3/tsearch.3:181
1830 msgid ""
1831 "The example program depends on the fact that B<twalk>()  makes no further "
1832 "reference to a node after calling the user function with argument \"endorder"
1833 "\" or \"leaf\".  This works with the GNU library implementation, but is not "
1834 "in the System V documentation."
1835 msgstr ""
1836 "下のプログラム例は、ユーザ関数が \"endorder\" か \"leaf\" を引数にして 呼び出"
1837 "されて以降は、 B<twalk>()  がそのノードを参照しないことを前提としている。 こ"
1838 "れは GNU ライブラリの実装では機能するが、System V のマニュアルには存在しな"
1839 "い。"
1840
1841 #. type: Plain text
1842 #: build/C/man3/tsearch.3:185
1843 msgid ""
1844 "The following program inserts twelve random numbers into a binary tree, "
1845 "where duplicate numbers are collapsed, then prints the numbers in order."
1846 msgstr ""
1847 "以下のプログラムは 12 個の乱数を二分木に挿入した後、 挿入した数を順番に出力す"
1848 "る (挿入の際、重複した乱数は 1 つにまとめられる)。"
1849
1850 #. type: Plain text
1851 #: build/C/man3/tsearch.3:192
1852 #, no-wrap
1853 msgid ""
1854 "#define _GNU_SOURCE     /* Expose declaration of tdestroy() */\n"
1855 "#include E<lt>search.hE<gt>\n"
1856 "#include E<lt>stdlib.hE<gt>\n"
1857 "#include E<lt>stdio.hE<gt>\n"
1858 "#include E<lt>time.hE<gt>\n"
1859 msgstr ""
1860 "#define _GNU_SOURCE     /* Expose declaration of tdestroy() */\n"
1861 "#include E<lt>search.hE<gt>\n"
1862 "#include E<lt>stdlib.hE<gt>\n"
1863 "#include E<lt>stdio.hE<gt>\n"
1864 "#include E<lt>time.hE<gt>\n"
1865
1866 #. type: Plain text
1867 #: build/C/man3/tsearch.3:194
1868 #, no-wrap
1869 msgid "void *root = NULL;\n"
1870 msgstr "void *root = NULL;\n"
1871
1872 #. type: Plain text
1873 #: build/C/man3/tsearch.3:205
1874 #, no-wrap
1875 msgid ""
1876 "void *\n"
1877 "xmalloc(unsigned n)\n"
1878 "{\n"
1879 "    void *p;\n"
1880 "    p = malloc(n);\n"
1881 "    if (p)\n"
1882 "        return p;\n"
1883 "    fprintf(stderr, \"insufficient memory\\en\");\n"
1884 "    exit(EXIT_FAILURE);\n"
1885 "}\n"
1886 msgstr ""
1887 "void *\n"
1888 "xmalloc(unsigned n)\n"
1889 "{\n"
1890 "    void *p;\n"
1891 "    p = malloc(n);\n"
1892 "    if (p)\n"
1893 "        return p;\n"
1894 "    fprintf(stderr, \"insufficient memory\\en\");\n"
1895 "    exit(EXIT_FAILURE);\n"
1896 "}\n"
1897
1898 #. type: Plain text
1899 #: build/C/man3/tsearch.3:215
1900 #, no-wrap
1901 msgid ""
1902 "int\n"
1903 "compare(const void *pa, const void *pb)\n"
1904 "{\n"
1905 "    if (*(int *) pa E<lt> *(int *) pb)\n"
1906 "        return -1;\n"
1907 "    if (*(int *) pa E<gt> *(int *) pb)\n"
1908 "        return 1;\n"
1909 "    return 0;\n"
1910 "}\n"
1911 msgstr ""
1912 "int\n"
1913 "compare(const void *pa, const void *pb)\n"
1914 "{\n"
1915 "    if (*(int *) pa E<lt> *(int *) pb)\n"
1916 "        return -1;\n"
1917 "    if (*(int *) pa E<gt> *(int *) pb)\n"
1918 "        return 1;\n"
1919 "    return 0;\n"
1920 "}\n"
1921
1922 #. type: Plain text
1923 #: build/C/man3/tsearch.3:220
1924 #, no-wrap
1925 msgid ""
1926 "void\n"
1927 "action(const void *nodep, const VISIT which, const int depth)\n"
1928 "{\n"
1929 "    int *datap;\n"
1930 msgstr ""
1931 "void\n"
1932 "action(const void *nodep, const VISIT which, const int depth)\n"
1933 "{\n"
1934 "    int *datap;\n"
1935
1936 #. type: Plain text
1937 #: build/C/man3/tsearch.3:236
1938 #, no-wrap
1939 msgid ""
1940 "    switch (which) {\n"
1941 "    case preorder:\n"
1942 "        break;\n"
1943 "    case postorder:\n"
1944 "        datap = *(int **) nodep;\n"
1945 "        printf(\"%6d\\en\", *datap);\n"
1946 "        break;\n"
1947 "    case endorder:\n"
1948 "        break;\n"
1949 "    case leaf:\n"
1950 "        datap = *(int **) nodep;\n"
1951 "        printf(\"%6d\\en\", *datap);\n"
1952 "        break;\n"
1953 "    }\n"
1954 "}\n"
1955 msgstr ""
1956 "    switch (which) {\n"
1957 "    case preorder:\n"
1958 "        break;\n"
1959 "    case postorder:\n"
1960 "        datap = *(int **) nodep;\n"
1961 "        printf(\"%6d\\en\", *datap);\n"
1962 "        break;\n"
1963 "    case endorder:\n"
1964 "        break;\n"
1965 "    case leaf:\n"
1966 "        datap = *(int **) nodep;\n"
1967 "        printf(\"%6d\\en\", *datap);\n"
1968 "        break;\n"
1969 "    }\n"
1970 "}\n"
1971
1972 #. type: Plain text
1973 #: build/C/man3/tsearch.3:242
1974 #, no-wrap
1975 msgid ""
1976 "int\n"
1977 "main(void)\n"
1978 "{\n"
1979 "    int i, *ptr;\n"
1980 "    void *val;\n"
1981 msgstr ""
1982 "int\n"
1983 "main(void)\n"
1984 "{\n"
1985 "    int i, *ptr;\n"
1986 "    void *val;\n"
1987
1988 #. type: Plain text
1989 #: build/C/man3/tsearch.3:257
1990 #, no-wrap
1991 msgid ""
1992 "    srand(time(NULL));\n"
1993 "    for (i = 0; i E<lt> 12; i++) {\n"
1994 "        ptr = (int *) xmalloc(sizeof(int));\n"
1995 "        *ptr = rand() & 0xff;\n"
1996 "        val = tsearch((void *) ptr, &root, compare);\n"
1997 "        if (val == NULL)\n"
1998 "            exit(EXIT_FAILURE);\n"
1999 "        else if ((*(int **) val) != ptr)\n"
2000 "            free(ptr);\n"
2001 "    }\n"
2002 "    twalk(root, action);\n"
2003 "    tdestroy(root, free);\n"
2004 "    exit(EXIT_SUCCESS);\n"
2005 "}\n"
2006 msgstr ""
2007 "    srand(time(NULL));\n"
2008 "    for (i = 0; i E<lt> 12; i++) {\n"
2009 "        ptr = (int *) xmalloc(sizeof(int));\n"
2010 "        *ptr = rand() & 0xff;\n"
2011 "        val = tsearch((void *) ptr, &root, compare);\n"
2012 "        if (val == NULL)\n"
2013 "            exit(EXIT_FAILURE);\n"
2014 "        else if ((*(int **) val) != ptr)\n"
2015 "            free(ptr);\n"
2016 "    }\n"
2017 "    twalk(root, action);\n"
2018 "    tdestroy(root, free);\n"
2019 "    exit(EXIT_SUCCESS);\n"
2020 "}\n"
2021
2022 #. type: Plain text
2023 #: build/C/man3/tsearch.3:263
2024 msgid "B<bsearch>(3), B<hsearch>(3), B<lsearch>(3), B<qsort>(3)"
2025 msgstr "B<bsearch>(3), B<hsearch>(3), B<lsearch>(3)  B<qsort>(3)"
2026
2027 #~ msgid "SVr4, 4.3BSD, C89, C99."
2028 #~ msgstr "SVr4, 4.3BSD, C89, C99."
2029
2030 #~ msgid ""
2031 #~ "B<insque>(), B<remque>(): _SVID_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500"
2032 #~ msgstr ""
2033 #~ "B<insque>(), B<remque>(): _SVID_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500"