OSDN Git Service

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