OSDN Git Service

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