Debian Codegraph @

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