diff options
Diffstat (limited to 'man3/inet_pton.3')
-rw-r--r-- | man3/inet_pton.3 | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/man3/inet_pton.3 b/man3/inet_pton.3 index 2c9630110..420a64251 100644 --- a/man3/inet_pton.3 +++ b/man3/inet_pton.3 @@ -5,7 +5,7 @@ .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" .\" References: RFC 2553 -.TH inet_pton 3 2023-02-05 "Linux man-pages 6.03" +.TH inet_pton 3 2023-07-20 "Linux man-pages 6.05.01" .SH NAME inet_pton \- convert IPv4 and IPv6 addresses from text to binary form .SH LIBRARY @@ -116,23 +116,19 @@ is set to .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). -.ad l -.nh .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ +.na +.nh .BR inet_pton () T} Thread safety MT-Safe locale .TE -.hy -.ad .sp 1 -.SH STANDARDS -POSIX.1-2001, POSIX.1-2008. -.SH NOTES +.SH VERSIONS Unlike .BR inet_aton (3) and @@ -151,6 +147,10 @@ four bytes to be explicitly written). For an interface that handles both IPv6 addresses, and IPv4 addresses in numbers-and-dots notation, see .BR getaddrinfo (3). +.SH STANDARDS +POSIX.1-2008. +.SH HISTORY +POSIX.1-2001. .SH BUGS .B AF_INET6 does not recognize IPv4 addresses. @@ -182,22 +182,22 @@ Here are some example runs: #include <stdio.h> #include <stdlib.h> #include <string.h> - +\& int main(int argc, char *argv[]) { unsigned char buf[sizeof(struct in6_addr)]; int domain, s; char str[INET6_ADDRSTRLEN]; - +\& if (argc != 3) { fprintf(stderr, "Usage: %s {i4|i6|<num>} string\en", argv[0]); exit(EXIT_FAILURE); } - +\& domain = (strcmp(argv[1], "i4") == 0) ? AF_INET : (strcmp(argv[1], "i6") == 0) ? AF_INET6 : atoi(argv[1]); - +\& s = inet_pton(domain, argv[2], buf); if (s <= 0) { if (s == 0) @@ -206,14 +206,14 @@ main(int argc, char *argv[]) perror("inet_pton"); exit(EXIT_FAILURE); } - +\& if (inet_ntop(domain, buf, str, INET6_ADDRSTRLEN) == NULL) { perror("inet_ntop"); exit(EXIT_FAILURE); } - +\& printf("%s\en", str); - +\& exit(EXIT_SUCCESS); } .EE |