]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/getprotoent_r.3
Start of man-pages-5.03: renaming .Announce and .lsm files
[thirdparty/man-pages.git] / man3 / getprotoent_r.3
index 8d25c0c9aa87c2d8bd6ee1e8e891eb374d814d1a..57b9c63afbdc63af23cb727f5332c0bd58abf609 100644 (file)
 .\" the source, must acknowledge the copyright and authors of this work.
 .\" %%%LICENSE_END
 .\"
-.TH GETPROTOENT_R 3  2010-09-10 "GNU" "Linux Programmer's Manual"
+.TH GETPROTOENT_R 3  2019-03-06 "GNU" "Linux Programmer's Manual"
 .SH NAME
 getprotoent_r, getprotobyname_r, getprotobynumber_r \- get
 protocol entry (reentrant)
 .SH SYNOPSIS
 .nf
 .B #include <netdb.h>
-.sp
+.PP
 .BI "int getprotoent_r(struct protoent *" result_buf ", char *" buf ,
 .BI "                size_t " buflen ", struct protoent **" result );
-.sp
+.PP
 .BI "int getprotobyname_r(const char *" name ,
 .BI "                struct protoent *" result_buf ", char *" buf ,
 .BI "                size_t " buflen ", struct protoent **" result );
-.sp
+.PP
 .BI "int getprotobynumber_r(int " proto ,
 .BI "                struct protoent *" result_buf ", char *" buf ,
 .BI "                size_t " buflen ", struct protoent **" result );
-.sp
+.PP
 .fi
 .in -4n
 Feature Test Macro Requirements for glibc (see
 .BR feature_test_macros (7)):
 .ad l
 .in
-.sp
+.PP
 .BR getprotoent_r (),
 .BR getprotobyname_r (),
 .BR getprotobynumber_r ():
-.RS 4
-_BSD_SOURCE || _SVID_SOURCE
-.RE
+    Since glibc 2.19:
+        _DEFAULT_SOURCE
+    Glibc 2.19 and earlier:
+        _BSD_SOURCE || _SVID_SOURCE
 .ad b
 .SH DESCRIPTION
 The
@@ -73,13 +74,13 @@ structure is returned,
 and in the function calling signature and return value.
 This manual page describes just the differences from
 the nonreentrant functions.
-
+.PP
 Instead of returning a pointer to a statically allocated
 .I protoent
 structure as the function result,
 these functions copy the structure into the location pointed to by
 .IR result_buf .
-
+.PP
 The
 .I buf
 array is used to store the string fields pointed to by the returned
@@ -97,7 +98,7 @@ and the caller must try again with a larger buffer.
 .\" I can find no information on the required/recommended buffer size;
 .\" the nonreentrant functions use a 1024 byte buffer.
 .\" The 1024 byte value is also what the Solaris man page suggests. -- mtk
-
+.PP
 If the function call successfully obtains a protocol record, then
 .I *result
 is set pointing to
@@ -108,7 +109,7 @@ is set to NULL.
 .SH RETURN VALUE
 On success, these functions return 0.
 On error, they return one of the positive error numbers listed in ERRORS.
-
+.PP
 On error, record not found
 .RB ( getprotobyname_r (),
 .BR getprotobynumber_r ()),
@@ -128,6 +129,23 @@ is too small.
 Try again with a larger buffer
 (and increased
 .IR buflen ).
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbw20 lb lb
+l l l.
+Interface      Attribute       Value
+T{
+.BR getprotoent_r (),
+.br
+.BR getprotobyname_r (),
+.br
+.BR getprotobynumber_r ()
+T}     Thread safety   MT-Safe locale
+.TE
+.sp 1
 .SH CONFORMING TO
 These functions are GNU extensions.
 Functions with similar names exist on some other systems,
@@ -146,9 +164,9 @@ fails with the error
 .BR ERANGE ,
 the program retries with larger buffer sizes.
 The following shell session shows a couple of sample runs:
+.PP
 .in +4n
-.nf
-
+.EX
 .RB "$" " ./a.out tcp 1"
 ERANGE! Retrying with larger buffer
 getprotobyname_r() returned: 0 (success)  (buflen=78)
@@ -157,11 +175,11 @@ p_name=tcp; p_proto=6; aliases=TCP
 ERANGE! Retrying with larger buffer
 getprotobyname_r() returned: 0 (success)  (buflen=100)
 Call failed/record not found
-.fi
+.EE
 .in
 .SS Program source
 \&
-.nf
+.EX
 #define _GNU_SOURCE
 #include <ctype.h>
 #include <netdb.h>
@@ -182,7 +200,7 @@ main(int argc, char *argv[])
     char **p;
 
     if (argc < 2) {
-        printf("Usage: %s proto\-name [buflen]\\n", argv[0]);
+        printf("Usage: %s proto\-name [buflen]\en", argv[0]);
         exit(EXIT_FAILURE);
     }
 
@@ -191,7 +209,7 @@ main(int argc, char *argv[])
         buflen = atoi(argv[2]);
 
     if (buflen > MAX_BUF) {
-        printf("Exceeded buffer limit (%d)\\n", MAX_BUF);
+        printf("Exceeded buffer limit (%d)\en", MAX_BUF);
         exit(EXIT_FAILURE);
     }
 
@@ -201,7 +219,7 @@ main(int argc, char *argv[])
                      buf, buflen, &result);
         if (s == ERANGE) {
             if (erange_cnt == 0)
-                printf("ERANGE! Retrying with larger buffer\\n");
+                printf("ERANGE! Retrying with larger buffer\en");
             erange_cnt++;
 
             /* Increment a byte at a time so we can see exactly
@@ -210,18 +228,18 @@ main(int argc, char *argv[])
             buflen++;
 
             if (buflen > MAX_BUF) {
-                printf("Exceeded buffer limit (%d)\\n", MAX_BUF);
+                printf("Exceeded buffer limit (%d)\en", MAX_BUF);
                 exit(EXIT_FAILURE);
             }
         }
     } while (s == ERANGE);
 
-    printf("getprotobyname_r() returned: %s  (buflen=%d)\\n",
+    printf("getprotobyname_r() returned: %s  (buflen=%d)\en",
             (s == 0) ? "0 (success)" : (s == ENOENT) ? "ENOENT" :
             strerror(s), buflen);
 
     if (s != 0 || result == NULL) {
-        printf("Call failed/record not found\\n");
+        printf("Call failed/record not found\en");
         exit(EXIT_FAILURE);
     }
 
@@ -229,11 +247,11 @@ main(int argc, char *argv[])
                 result_buf.p_name, result_buf.p_proto);
     for (p = result_buf.p_aliases; *p != NULL; p++)
         printf("%s ", *p);
-    printf("\\n");
+    printf("\en");
 
     exit(EXIT_SUCCESS);
 }
-.fi
+.EE
 .SH SEE ALSO
 .BR getprotoent (3),
 .BR protocols (5)