Debian Codegraph @

templates/man3/getprotoent_r.3.pot

raw
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 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-06-05 06:25+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "getprotoent_r"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2025-09-21"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid ""
50 "getprotoent_r, getprotobyname_r, getprotobynumber_r - get protocol entry "
51 "(reentrant)"
52 msgstr ""
53
54 #. type: SH
55 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
56 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
57 #, no-wrap
58 msgid "LIBRARY"
59 msgstr ""
60
61 #. type: Plain text
62 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
63 #: opensuse-leap-16-1 opensuse-tumbleweed
64 msgid "Standard C library (I<libc>,\\ I<-lc>)"
65 msgstr ""
66
67 #. type: SH
68 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
69 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
70 #, no-wrap
71 msgid "SYNOPSIS"
72 msgstr ""
73
74 #. type: Plain text
75 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
76 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
77 #, no-wrap
78 msgid "B<#include E<lt>netdb.hE<gt>>\n"
79 msgstr ""
80
81 #. type: Plain text
82 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
83 #: opensuse-tumbleweed
84 #, no-wrap
85 msgid ""
86 "B<int getprotoent_r(>size_t size;\n"
87 "B< struct protoent *restrict >I<result_buf>B<,>\n"
88 "B< char >I<buf>B<[restrict >I<size>B<], size_t >I<size>B<,>\n"
89 "B< struct protoent **restrict >I<result>B<);>\n"
90 "B<int getprotobyname_r(>size_t size;\n"
91 "B< const char *restrict >I<name>B<,>\n"
92 "B< struct protoent *restrict >I<result_buf>B<,>\n"
93 "B< char >I<buf>B<[restrict >I<size>B<], size_t >I<size>B<,>\n"
94 "B< struct protoent **restrict >I<result>B<);>\n"
95 "B<int getprotobynumber_r(>size_t size;\n"
96 "B< int >I<proto>B<,>\n"
97 "B< struct protoent *restrict >I<result_buf>B<,>\n"
98 "B< char >I<buf>B<[restrict >I<size>B<], size_t >I<size>B<,>\n"
99 "B< struct protoent **restrict >I<result>B<);>\n"
100 msgstr ""
101
102 #. type: Plain text
103 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
104 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
105 msgid ""
106 "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
107 msgstr ""
108
109 #. type: Plain text
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 msgid "B<getprotoent_r>(), B<getprotobyname_r>(), B<getprotobynumber_r>():"
113 msgstr ""
114
115 #. type: Plain text
116 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
117 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
118 #, no-wrap
119 msgid ""
120 " Since glibc 2.19:\n"
121 " _DEFAULT_SOURCE\n"
122 " glibc 2.19 and earlier:\n"
123 " _BSD_SOURCE || _SVID_SOURCE\n"
124 msgstr ""
125
126 #. type: SH
127 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
128 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
129 #, no-wrap
130 msgid "DESCRIPTION"
131 msgstr ""
132
133 #. type: Plain text
134 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
135 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
136 msgid ""
137 "The B<getprotoent_r>(), B<getprotobyname_r>(), and B<getprotobynumber_r>() "
138 "functions are the reentrant equivalents of, respectively, B<getprotoent>(3), "
139 "B<getprotobyname>(3), and B<getprotobynumber>(3). They differ in the way "
140 "that the I<protoent> structure is returned, and in the function calling "
141 "signature and return value. This manual page describes just the differences "
142 "from the nonreentrant functions."
143 msgstr ""
144
145 #. type: Plain text
146 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
147 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
148 msgid ""
149 "Instead of returning a pointer to a statically allocated I<protoent> "
150 "structure as the function result, these functions copy the structure into "
151 "the location pointed to by I<result_buf>."
152 msgstr ""
153
154 #. #-#-#-#-# archlinux: getprotoent_r.3.pot (PACKAGE VERSION) #-#-#-#-#
155 #. I can find no information on the required/recommended buffer size;
156 #. the nonreentrant functions use a 1024 byte buffer.
157 #. The 1024 byte value is also what the Solaris man page suggests. -- mtk
158 #. type: Plain text
159 #. #-#-#-#-# debian-unstable: getprotoent_r.3.pot (PACKAGE VERSION) #-#-#-#-#
160 #. I can find no information on the required/recommended buffer size;
161 #. the nonreentrant functions use a 1024 byte buffer.
162 #. The 1024 byte value is also what the Solaris man page suggests. -- mtk
163 #. type: Plain text
164 #. #-#-#-#-# fedora-44: getprotoent_r.3.pot (PACKAGE VERSION) #-#-#-#-#
165 #. I can find no information on the required/recommended buffer size;
166 #. the nonreentrant functions use a 1024 byte buffer.
167 #. The 1024 byte value is also what the Solaris man page suggests. -- mtk
168 #. type: Plain text
169 #. #-#-#-#-# fedora-rawhide: getprotoent_r.3.pot (PACKAGE VERSION) #-#-#-#-#
170 #. I can find no information on the required/recommended buffer size;
171 #. the nonreentrant functions use a 1024 byte buffer.
172 #. The 1024 byte value is also what the Solaris man page suggests. -- mtk
173 #. type: Plain text
174 #. #-#-#-#-# mageia-cauldron: getprotoent_r.3.pot (PACKAGE VERSION) #-#-#-#-#
175 #. I can find no information on the required/recommended buffer size;
176 #. the nonreentrant functions use a 1024 byte buffer.
177 #. The 1024 byte value is also what the Solaris man page suggests. -- mtk
178 #. type: Plain text
179 #. #-#-#-#-# opensuse-leap-16-1: getprotoent_r.3.pot (PACKAGE VERSION) #-#-#-#-#
180 #. I can find no information on the required/recommended buffer size;
181 #. the nonreentrant functions use a 1024 byte buffer.
182 #. The 1024 byte value is also what the Solaris man page suggests. -- mtk
183 #. type: Plain text
184 #. #-#-#-#-# opensuse-tumbleweed: getprotoent_r.3.pot (PACKAGE VERSION) #-#-#-#-#
185 #. I can find no information on the required/recommended buffer size;
186 #. the nonreentrant functions use a 1024 byte buffer.
187 #. The 1024 byte value is also what the Solaris man page suggests. -- mtk
188 #. type: Plain text
189 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
190 #: opensuse-leap-16-1 opensuse-tumbleweed
191 msgid ""
192 "The I<buf> array is used to store the string fields pointed to by the "
193 "returned I<protoent> structure. (The nonreentrant functions allocate these "
194 "strings in static storage.) The size of this array is specified in "
195 "I<size>. If I<buf> is too small, the call fails with the error B<ERANGE>, "
196 "and the caller must try again with a larger buffer. (A buffer of size 1024 "
197 "bytes should be sufficient for most applications.)"
198 msgstr ""
199
200 #. type: Plain text
201 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
202 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
203 msgid ""
204 "If the function call successfully obtains a protocol record, then I<*result> "
205 "is set pointing to I<result_buf>; otherwise, I<*result> is set to NULL."
206 msgstr ""
207
208 #. type: SH
209 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
210 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
211 #, no-wrap
212 msgid "RETURN VALUE"
213 msgstr ""
214
215 #. type: Plain text
216 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
217 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
218 msgid ""
219 "On success, these functions return 0. On error, they return one of the "
220 "positive error numbers listed in ERRORS."
221 msgstr ""
222
223 #. type: Plain text
224 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
225 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
226 msgid ""
227 "On error, record not found (B<getprotobyname_r>(), B<getprotobynumber_r>()), "
228 "or end of input (B<getprotoent_r>()) I<result> is set to NULL."
229 msgstr ""
230
231 #. type: SH
232 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
233 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
234 #, no-wrap
235 msgid "ERRORS"
236 msgstr ""
237
238 #. type: TP
239 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
240 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
241 #, no-wrap
242 msgid "B<ENOENT>"
243 msgstr ""
244
245 #. type: Plain text
246 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
247 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
248 msgid "(B<getprotoent_r>()) No more records in database."
249 msgstr ""
250
251 #. type: TP
252 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
253 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
254 #, no-wrap
255 msgid "B<ERANGE>"
256 msgstr ""
257
258 #. type: Plain text
259 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
260 #: opensuse-leap-16-1 opensuse-tumbleweed
261 msgid ""
262 "I<buf> is too small. Try again with a larger buffer (and increased I<size>)."
263 msgstr ""
264
265 #. type: SH
266 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
267 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
268 #, no-wrap
269 msgid "ATTRIBUTES"
270 msgstr ""
271
272 #. type: Plain text
273 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
274 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
275 msgid ""
276 "For an explanation of the terms used in this section, see B<attributes>(7)."
277 msgstr ""
278
279 #. type: tbl table
280 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
281 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
282 #, no-wrap
283 msgid "Interface"
284 msgstr ""
285
286 #. type: tbl table
287 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
288 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
289 #, no-wrap
290 msgid "Attribute"
291 msgstr ""
292
293 #. type: tbl table
294 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
295 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
296 #, no-wrap
297 msgid "Value"
298 msgstr ""
299
300 #. type: tbl table
301 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
302 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
303 #, no-wrap
304 msgid ".na\n"
305 msgstr ""
306
307 #. type: tbl table
308 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
309 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
310 #, no-wrap
311 msgid ".nh\n"
312 msgstr ""
313
314 #. type: tbl table
315 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
316 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
317 #, no-wrap
318 msgid ""
319 "B<getprotoent_r>(),\n"
320 "B<getprotobyname_r>(),\n"
321 "B<getprotobynumber_r>()"
322 msgstr ""
323
324 #. type: tbl table
325 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
326 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
327 #, no-wrap
328 msgid "Thread safety"
329 msgstr ""
330
331 #. type: tbl table
332 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
333 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
334 #, no-wrap
335 msgid "MT-Safe locale"
336 msgstr ""
337
338 #. type: SH
339 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
340 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
341 #, no-wrap
342 msgid "VERSIONS"
343 msgstr ""
344
345 #. type: Plain text
346 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
347 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
348 msgid ""
349 "Functions with similar names exist on some other systems, though typically "
350 "with different calling signatures."
351 msgstr ""
352
353 #. type: SH
354 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
355 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
356 #, no-wrap
357 msgid "STANDARDS"
358 msgstr ""
359
360 #. type: Plain text
361 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
362 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
363 msgid "GNU."
364 msgstr ""
365
366 #. type: SH
367 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
368 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
369 #, no-wrap
370 msgid "EXAMPLES"
371 msgstr ""
372
373 #. type: Plain text
374 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
375 #: opensuse-leap-16-1 opensuse-tumbleweed
376 msgid ""
377 "The program below uses B<getprotobyname_r>() to retrieve the protocol "
378 "record for the protocol named in its first command-line argument. If a "
379 "second (integer) command-line argument is supplied, it is used as the "
380 "initial value for I<size>; if B<getprotobyname_r>() fails with the error "
381 "B<ERANGE>, the program retries with larger buffer sizes. The following "
382 "shell session shows a couple of sample runs:"
383 msgstr ""
384
385 #. type: Plain text
386 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
387 #: opensuse-leap-16-1 opensuse-tumbleweed
388 #, no-wrap
389 msgid ""
390 "$B< ./a.out tcp 1>\n"
391 "ERANGE! Retrying with larger buffer\n"
392 "getprotobyname_r() returned: 0 (success) (size=78)\n"
393 "p_name=tcp; p_proto=6; aliases=TCP\n"
394 "$B< ./a.out xxx 1>\n"
395 "ERANGE! Retrying with larger buffer\n"
396 "getprotobyname_r() returned: 0 (success) (size=100)\n"
397 "Call failed/record not found\n"
398 msgstr ""
399
400 #. type: SS
401 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
402 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
403 #, no-wrap
404 msgid "Program source"
405 msgstr ""
406
407 #. type: Plain text
408 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
409 #: opensuse-tumbleweed
410 #, no-wrap
411 msgid ""
412 "#define _GNU_SOURCE\n"
413 "#include E<lt>ctype.hE<gt>\n"
414 "#include E<lt>errno.hE<gt>\n"
415 "#include E<lt>netdb.hE<gt>\n"
416 "#include E<lt>stdio.hE<gt>\n"
417 "#include E<lt>stdlib.hE<gt>\n"
418 "#include E<lt>string.hE<gt>\n"
419 "\\&\n"
420 "#define MAX_BUF 10000\n"
421 "\\&\n"
422 "int\n"
423 "main(int argc, char *argv[])\n"
424 "{\n"
425 " int size, erange_cnt, s;\n"
426 " struct protoent result_buf;\n"
427 " struct protoent *result;\n"
428 " char buf[MAX_BUF];\n"
429 "\\&\n"
430 " if (argc E<lt> 2) {\n"
431 " printf(\"Usage: %s proto-name [size]\\[rs]n\", argv[0]);\n"
432 " exit(EXIT_FAILURE);\n"
433 " }\n"
434 "\\&\n"
435 " size = 1024;\n"
436 " if (argc E<gt> 2)\n"
437 " size = atoi(argv[2]);\n"
438 "\\&\n"
439 " if (size E<gt> MAX_BUF) {\n"
440 " printf(\"Exceeded buffer limit (%d)\\[rs]n\", MAX_BUF);\n"
441 " exit(EXIT_FAILURE);\n"
442 " }\n"
443 "\\&\n"
444 " erange_cnt = 0;\n"
445 " do {\n"
446 " s = getprotobyname_r(argv[1], &result_buf,\n"
447 " buf, size, &result);\n"
448 " if (s == ERANGE) {\n"
449 " if (erange_cnt == 0)\n"
450 " printf(\"ERANGE! Retrying with larger buffer\\[rs]n\");\n"
451 " erange_cnt++;\n"
452 "\\&\n"
453 " /* Increment a byte at a time so we can see exactly\n"
454 " what size buffer was required. */\n"
455 "\\&\n"
456 " size++;\n"
457 "\\&\n"
458 " if (size E<gt> MAX_BUF) {\n"
459 " printf(\"Exceeded buffer limit (%d)\\[rs]n\", MAX_BUF);\n"
460 " exit(EXIT_FAILURE);\n"
461 " }\n"
462 " }\n"
463 " } while (s == ERANGE);\n"
464 "\\&\n"
465 " printf(\"getprotobyname_r() returned: %s (size=%d)\\[rs]n\",\n"
466 " (s == 0) ? \"0 (success)\" : (s == ENOENT) ? \"ENOENT\" :\n"
467 " strerror(s), size);\n"
468 "\\&\n"
469 " if (s != 0 || result == NULL) {\n"
470 " printf(\"Call failed/record not found\\[rs]n\");\n"
471 " exit(EXIT_FAILURE);\n"
472 " }\n"
473 "\\&\n"
474 " printf(\"p_name=%s; p_proto=%d; aliases=\",\n"
475 " result_buf.p_name, result_buf.p_proto);\n"
476 " for (char **p = result_buf.p_aliases; *p != NULL; p++)\n"
477 " printf(\"%s \", *p);\n"
478 " printf(\"\\[rs]n\");\n"
479 "\\&\n"
480 " exit(EXIT_SUCCESS);\n"
481 "}\n"
482 msgstr ""
483
484 #. SRC END
485 #. type: SH
486 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
487 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
488 #, no-wrap
489 msgid "SEE ALSO"
490 msgstr ""
491
492 #. type: Plain text
493 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
494 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
495 msgid "B<getprotoent>(3), B<protocols>(5)"
496 msgstr ""
497
498 #. type: TH
499 #: debian-trixie
500 #, no-wrap
501 msgid "2024-06-15"
502 msgstr ""
503
504 #. type: TH
505 #: debian-trixie
506 #, no-wrap
507 msgid "Linux man-pages 6.9.1"
508 msgstr ""
509
510 #. type: Plain text
511 #: debian-trixie
512 msgid "Standard C library (I<libc>, I<-lc>)"
513 msgstr ""
514
515 #. type: Plain text
516 #: debian-trixie
517 #, no-wrap
518 msgid ""
519 "B<int getprotoent_r(struct protoent *restrict >I<result_buf>B<,>\n"
520 "B< char >I<buf>B<[restrict .>I<buflen>B<], size_t >I<buflen>B<,>\n"
521 "B< struct protoent **restrict >I<result>B<);>\n"
522 "B<int getprotobyname_r(const char *restrict >I<name>B<,>\n"
523 "B< struct protoent *restrict >I<result_buf>B<,>\n"
524 "B< char >I<buf>B<[restrict .>I<buflen>B<], size_t >I<buflen>B<,>\n"
525 "B< struct protoent **restrict >I<result>B<);>\n"
526 "B<int getprotobynumber_r(int >I<proto>B<,>\n"
527 "B< struct protoent *restrict >I<result_buf>B<,>\n"
528 "B< char >I<buf>B<[restrict .>I<buflen>B<], size_t >I<buflen>B<,>\n"
529 "B< struct protoent **restrict >I<result>B<);>\n"
530 msgstr ""
531
532 #. I can find no information on the required/recommended buffer size;
533 #. the nonreentrant functions use a 1024 byte buffer.
534 #. The 1024 byte value is also what the Solaris man page suggests. -- mtk
535 #. type: Plain text
536 #: debian-trixie
537 msgid ""
538 "The I<buf> array is used to store the string fields pointed to by the "
539 "returned I<protoent> structure. (The nonreentrant functions allocate these "
540 "strings in static storage.) The size of this array is specified in "
541 "I<buflen>. If I<buf> is too small, the call fails with the error B<ERANGE>, "
542 "and the caller must try again with a larger buffer. (A buffer of length "
543 "1024 bytes should be sufficient for most applications.)"
544 msgstr ""
545
546 #. type: Plain text
547 #: debian-trixie
548 msgid ""
549 "I<buf> is too small. Try again with a larger buffer (and increased "
550 "I<buflen>)."
551 msgstr ""
552
553 #. type: Plain text
554 #: debian-trixie
555 msgid ""
556 "The program below uses B<getprotobyname_r>() to retrieve the protocol "
557 "record for the protocol named in its first command-line argument. If a "
558 "second (integer) command-line argument is supplied, it is used as the "
559 "initial value for I<buflen>; if B<getprotobyname_r>() fails with the error "
560 "B<ERANGE>, the program retries with larger buffer sizes. The following "
561 "shell session shows a couple of sample runs:"
562 msgstr ""
563
564 #. type: Plain text
565 #: debian-trixie
566 #, no-wrap
567 msgid ""
568 "$B< ./a.out tcp 1>\n"
569 "ERANGE! Retrying with larger buffer\n"
570 "getprotobyname_r() returned: 0 (success) (buflen=78)\n"
571 "p_name=tcp; p_proto=6; aliases=TCP\n"
572 "$B< ./a.out xxx 1>\n"
573 "ERANGE! Retrying with larger buffer\n"
574 "getprotobyname_r() returned: 0 (success) (buflen=100)\n"
575 "Call failed/record not found\n"
576 msgstr ""
577
578 #. type: Plain text
579 #: debian-trixie
580 #, no-wrap
581 msgid ""
582 "#define _GNU_SOURCE\n"
583 "#include E<lt>ctype.hE<gt>\n"
584 "#include E<lt>errno.hE<gt>\n"
585 "#include E<lt>netdb.hE<gt>\n"
586 "#include E<lt>stdio.hE<gt>\n"
587 "#include E<lt>stdlib.hE<gt>\n"
588 "#include E<lt>string.hE<gt>\n"
589 "\\&\n"
590 "#define MAX_BUF 10000\n"
591 "\\&\n"
592 "int\n"
593 "main(int argc, char *argv[])\n"
594 "{\n"
595 " int buflen, erange_cnt, s;\n"
596 " struct protoent result_buf;\n"
597 " struct protoent *result;\n"
598 " char buf[MAX_BUF];\n"
599 "\\&\n"
600 " if (argc E<lt> 2) {\n"
601 " printf(\"Usage: %s proto-name [buflen]\\[rs]n\", argv[0]);\n"
602 " exit(EXIT_FAILURE);\n"
603 " }\n"
604 "\\&\n"
605 " buflen = 1024;\n"
606 " if (argc E<gt> 2)\n"
607 " buflen = atoi(argv[2]);\n"
608 "\\&\n"
609 " if (buflen E<gt> MAX_BUF) {\n"
610 " printf(\"Exceeded buffer limit (%d)\\[rs]n\", MAX_BUF);\n"
611 " exit(EXIT_FAILURE);\n"
612 " }\n"
613 "\\&\n"
614 " erange_cnt = 0;\n"
615 " do {\n"
616 " s = getprotobyname_r(argv[1], &result_buf,\n"
617 " buf, buflen, &result);\n"
618 " if (s == ERANGE) {\n"
619 " if (erange_cnt == 0)\n"
620 " printf(\"ERANGE! Retrying with larger buffer\\[rs]n\");\n"
621 " erange_cnt++;\n"
622 "\\&\n"
623 " /* Increment a byte at a time so we can see exactly\n"
624 " what size buffer was required. */\n"
625 "\\&\n"
626 " buflen++;\n"
627 "\\&\n"
628 " if (buflen E<gt> MAX_BUF) {\n"
629 " printf(\"Exceeded buffer limit (%d)\\[rs]n\", MAX_BUF);\n"
630 " exit(EXIT_FAILURE);\n"
631 " }\n"
632 " }\n"
633 " } while (s == ERANGE);\n"
634 "\\&\n"
635 " printf(\"getprotobyname_r() returned: %s (buflen=%d)\\[rs]n\",\n"
636 " (s == 0) ? \"0 (success)\" : (s == ENOENT) ? \"ENOENT\" :\n"
637 " strerror(s), buflen);\n"
638 "\\&\n"
639 " if (s != 0 || result == NULL) {\n"
640 " printf(\"Call failed/record not found\\[rs]n\");\n"
641 " exit(EXIT_FAILURE);\n"
642 " }\n"
643 "\\&\n"
644 " printf(\"p_name=%s; p_proto=%d; aliases=\",\n"
645 " result_buf.p_name, result_buf.p_proto);\n"
646 " for (char **p = result_buf.p_aliases; *p != NULL; p++)\n"
647 " printf(\"%s \", *p);\n"
648 " printf(\"\\[rs]n\");\n"
649 "\\&\n"
650 " exit(EXIT_SUCCESS);\n"
651 "}\n"
652 msgstr ""
653
654 #. type: TH
655 #: fedora-44 fedora-rawhide
656 #, no-wrap
657 msgid "2024-12-24"
658 msgstr ""
659
660 #. type: TH
661 #: fedora-44 fedora-rawhide
662 #, no-wrap
663 msgid "Linux man-pages 6.13"
664 msgstr ""
665
666 #. type: Plain text
667 #: fedora-44 fedora-rawhide
668 #, no-wrap
669 msgid ""
670 "B<int getprotoent_r(struct protoent *restrict >I<result_buf>B<,>\n"
671 "B< char >I<buf>B<[restrict .>I<size>B<], size_t >I<size>B<,>\n"
672 "B< struct protoent **restrict >I<result>B<);>\n"
673 "B<int getprotobyname_r(const char *restrict >I<name>B<,>\n"
674 "B< struct protoent *restrict >I<result_buf>B<,>\n"
675 "B< char >I<buf>B<[restrict .>I<size>B<], size_t >I<size>B<,>\n"
676 "B< struct protoent **restrict >I<result>B<);>\n"
677 "B<int getprotobynumber_r(int >I<proto>B<,>\n"
678 "B< struct protoent *restrict >I<result_buf>B<,>\n"
679 "B< char >I<buf>B<[restrict .>I<size>B<], size_t >I<size>B<,>\n"
680 "B< struct protoent **restrict >I<result>B<);>\n"
681 msgstr ""
682
683 #. type: Plain text
684 #: fedora-44 fedora-rawhide
685 #, no-wrap
686 msgid ""
687 "#define _GNU_SOURCE\n"
688 "#include E<lt>ctype.hE<gt>\n"
689 "#include E<lt>errno.hE<gt>\n"
690 "#include E<lt>netdb.hE<gt>\n"
691 "#include E<lt>stdio.hE<gt>\n"
692 "#include E<lt>stdlib.hE<gt>\n"
693 "#include E<lt>string.hE<gt>\n"
694 "\\&\n"
695 "#define MAX_BUF 10000\n"
696 "\\&\n"
697 "int\n"
698 "main(int argc, char *argv[])\n"
699 "{\n"
700 " int size, erange_cnt, s;\n"
701 " struct protoent result_buf;\n"
702 " struct protoent *result;\n"
703 " char buf[MAX_BUF];\n"
704 "\\&\n"
705 " if (argc E<lt> 2) {\n"
706 " printf(\"Usage: %s proto-name [size]\\[rs]n\", argv[0]);\n"
707 " exit(EXIT_FAILURE);\n"
708 " }\n"
709 "\\&\n"
710 " size = 1024;\n"
711 " if (argc E<gt> 2)\n"
712 " size = atoi(argv[2]);\n"
713 "\\&\n"
714 " if (size E<gt> MAX_BUF) {\n"
715 " printf(\"Exceeded buffer limit (%d)\\[rs]n\", MAX_BUF);\n"
716 " exit(EXIT_FAILURE);\n"
717 " }\n"
718 "\\&\n"
719 " erange_cnt = 0;\n"
720 " do {\n"
721 " s = getprotobyname_r(argv[1], &result_buf,\n"
722 " buf, size, &result);\n"
723 " if (s == ERANGE) {\n"
724 " if (erange_cnt == 0)\n"
725 " printf(\"ERANGE! Retrying with larger buffer\\[rs]n\");\n"
726 " erange_cnt++;\n"
727 "\\&\n"
728 " /* Increment a byte at a time so we can see exactly\n"
729 " what size buffer was required. */\n"
730 "\\&\n"
731 " size++;\n"
732 "\\&\n"
733 " if (size E<gt> MAX_BUF) {\n"
734 " printf(\"Exceeded buffer limit (%d)\\[rs]n\", MAX_BUF);\n"
735 " exit(EXIT_FAILURE);\n"
736 " }\n"
737 " }\n"
738 " } while (s == ERANGE);\n"
739 "\\&\n"
740 " printf(\"getprotobyname_r() returned: %s (size=%d)\\[rs]n\",\n"
741 " (s == 0) ? \"0 (success)\" : (s == ENOENT) ? \"ENOENT\" :\n"
742 " strerror(s), size);\n"
743 "\\&\n"
744 " if (s != 0 || result == NULL) {\n"
745 " printf(\"Call failed/record not found\\[rs]n\");\n"
746 " exit(EXIT_FAILURE);\n"
747 " }\n"
748 "\\&\n"
749 " printf(\"p_name=%s; p_proto=%d; aliases=\",\n"
750 " result_buf.p_name, result_buf.p_proto);\n"
751 " for (char **p = result_buf.p_aliases; *p != NULL; p++)\n"
752 " printf(\"%s \", *p);\n"
753 " printf(\"\\[rs]n\");\n"
754 "\\&\n"
755 " exit(EXIT_SUCCESS);\n"
756 "}\n"
757 msgstr ""
758
759 #. type: TH
760 #: mageia-cauldron
761 #, no-wrap
762 msgid "Linux man-pages 6.17"
763 msgstr ""
764
765 #. type: TH
766 #: opensuse-leap-16-1 opensuse-tumbleweed
767 #, no-wrap
768 msgid "Linux man-pages (unreleased)"
769 msgstr ""