OSDN Git Service

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