diff options
author | jmc <> | 2012-04-20 07:00:21 +0000 |
---|---|---|
committer | jmc <> | 2012-04-20 07:00:21 +0000 |
commit | cac7bfdacac68dd010c6c082d280538c48791fe2 (patch) | |
tree | 6369489aa16e1f30392e6066a881e09a340e3535 | |
parent | 891102fe0de88602dbd6799f09c9578690841f95 (diff) | |
download | openbsd-cac7bfdacac68dd010c6c082d280538c48791fe2.tar.gz openbsd-cac7bfdacac68dd010c6c082d280538c48791fe2.tar.bz2 openbsd-cac7bfdacac68dd010c6c082d280538c48791fe2.zip |
rearrange DESCRIPTION somewhat to make this page more readable;
from Lawrence Teo
-rw-r--r-- | src/lib/libc/net/inet.3 | 79 |
1 files changed, 40 insertions, 39 deletions
diff --git a/src/lib/libc/net/inet.3 b/src/lib/libc/net/inet.3 index 3f198ae8e0..ba7a3c8375 100644 --- a/src/lib/libc/net/inet.3 +++ b/src/lib/libc/net/inet.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: inet.3,v 1.22 2008/12/09 19:38:38 otto Exp $ | 1 | .\" $OpenBSD: inet.3,v 1.23 2012/04/20 07:00:21 jmc Exp $ |
2 | .\" $NetBSD: inet.3,v 1.7 1997/06/18 02:25:24 lukem Exp $ | 2 | .\" $NetBSD: inet.3,v 1.7 1997/06/18 02:25:24 lukem Exp $ |
3 | .\" | 3 | .\" |
4 | .\" Copyright (c) 1983, 1990, 1991, 1993 | 4 | .\" Copyright (c) 1983, 1990, 1991, 1993 |
@@ -30,43 +30,43 @@ | |||
30 | .\" | 30 | .\" |
31 | .\" @(#)inet.3 8.1 (Berkeley) 6/4/93 | 31 | .\" @(#)inet.3 8.1 (Berkeley) 6/4/93 |
32 | .\" | 32 | .\" |
33 | .Dd $Mdocdate: December 9 2008 $ | 33 | .Dd $Mdocdate: April 20 2012 $ |
34 | .Dt INET 3 | 34 | .Dt INET 3 |
35 | .Os | 35 | .Os |
36 | .Sh NAME | 36 | .Sh NAME |
37 | .Nm inet_addr , | ||
38 | .Nm inet_aton , | 37 | .Nm inet_aton , |
39 | .Nm inet_lnaof , | 38 | .Nm inet_addr , |
40 | .Nm inet_makeaddr , | ||
41 | .Nm inet_netof , | ||
42 | .Nm inet_network , | 39 | .Nm inet_network , |
43 | .Nm inet_ntoa , | 40 | .Nm inet_pton , |
44 | .Nm inet_ntop , | 41 | .Nm inet_ntop , |
45 | .Nm inet_pton | 42 | .Nm inet_ntoa , |
43 | .Nm inet_makeaddr , | ||
44 | .Nm inet_netof , | ||
45 | .Nm inet_lnaof | ||
46 | .Nd Internet address manipulation routines | 46 | .Nd Internet address manipulation routines |
47 | .Sh SYNOPSIS | 47 | .Sh SYNOPSIS |
48 | .Fd #include <sys/types.h> | 48 | .Fd #include <sys/types.h> |
49 | .Fd #include <sys/socket.h> | 49 | .Fd #include <sys/socket.h> |
50 | .Fd #include <netinet/in.h> | 50 | .Fd #include <netinet/in.h> |
51 | .Fd #include <arpa/inet.h> | 51 | .Fd #include <arpa/inet.h> |
52 | .Ft in_addr_t | ||
53 | .Fn inet_addr "const char *cp" | ||
54 | .Ft int | 52 | .Ft int |
55 | .Fn inet_aton "const char *cp" "struct in_addr *addr" | 53 | .Fn inet_aton "const char *cp" "struct in_addr *addr" |
56 | .Ft in_addr_t | 54 | .Ft in_addr_t |
57 | .Fn inet_lnaof "struct in_addr in" | 55 | .Fn inet_addr "const char *cp" |
56 | .Ft in_addr_t | ||
57 | .Fn inet_network "const char *cp" | ||
58 | .Ft int | ||
59 | .Fn inet_pton "int af" "const char *src" "void *dst" | ||
60 | .Ft const char * | ||
61 | .Fn inet_ntop "int af" "const void *src" "char *dst" "socklen_t size" | ||
62 | .Ft char * | ||
63 | .Fn inet_ntoa "struct in_addr in" | ||
58 | .Ft struct in_addr | 64 | .Ft struct in_addr |
59 | .Fn inet_makeaddr "in_addr_t net" "in_addr_t lna" | 65 | .Fn inet_makeaddr "in_addr_t net" "in_addr_t lna" |
60 | .Ft in_addr_t | 66 | .Ft in_addr_t |
61 | .Fn inet_netof "struct in_addr in" | 67 | .Fn inet_netof "struct in_addr in" |
62 | .Ft in_addr_t | 68 | .Ft in_addr_t |
63 | .Fn inet_network "const char *cp" | 69 | .Fn inet_lnaof "struct in_addr in" |
64 | .Ft char * | ||
65 | .Fn inet_ntoa "struct in_addr in" | ||
66 | .Ft const char * | ||
67 | .Fn inet_ntop "int af" "const void *src" "char *dst" "socklen_t size" | ||
68 | .Ft int | ||
69 | .Fn inet_pton "int af" "const char *src" "void *dst" | ||
70 | .Sh DESCRIPTION | 70 | .Sh DESCRIPTION |
71 | The routines | 71 | The routines |
72 | .Fn inet_aton , | 72 | .Fn inet_aton , |
@@ -77,6 +77,25 @@ interpret character strings representing | |||
77 | numbers expressed in the Internet standard | 77 | numbers expressed in the Internet standard |
78 | .Dq dot | 78 | .Dq dot |
79 | notation. | 79 | notation. |
80 | .Pp | ||
81 | The | ||
82 | .Fn inet_aton | ||
83 | routine interprets the specified character string as an Internet address, | ||
84 | placing the address into the structure provided. | ||
85 | It returns 1 if the string was successfully interpreted, | ||
86 | or 0 if the string was invalid. | ||
87 | .Pp | ||
88 | The | ||
89 | .Fn inet_addr | ||
90 | and | ||
91 | .Fn inet_network | ||
92 | functions return numbers suitable for use | ||
93 | as Internet addresses and Internet network | ||
94 | numbers, respectively. | ||
95 | Both functions return the constant | ||
96 | .Dv INADDR_NONE | ||
97 | if the specified character string is malformed. | ||
98 | .Pp | ||
80 | The | 99 | The |
81 | .Fn inet_pton | 100 | .Fn inet_pton |
82 | function converts a presentation format address (that is, printable form | 101 | function converts a presentation format address (that is, printable form |
@@ -92,19 +111,6 @@ This function is presently valid for | |||
92 | .Dv AF_INET | 111 | .Dv AF_INET |
93 | and | 112 | and |
94 | .Dv AF_INET6 . | 113 | .Dv AF_INET6 . |
95 | The | ||
96 | .Fn inet_aton | ||
97 | routine interprets the specified character string as an Internet address, | ||
98 | placing the address into the structure provided. | ||
99 | It returns 1 if the string was successfully interpreted, | ||
100 | or 0 if the string was invalid. | ||
101 | The | ||
102 | .Fn inet_addr | ||
103 | and | ||
104 | .Fn inet_network | ||
105 | functions return numbers suitable for use | ||
106 | as Internet addresses and Internet network | ||
107 | numbers, respectively. | ||
108 | .Pp | 114 | .Pp |
109 | The function | 115 | The function |
110 | .Fn inet_ntop | 116 | .Fn inet_ntop |
@@ -118,15 +124,18 @@ if a system | |||
118 | error occurs (in which case, | 124 | error occurs (in which case, |
119 | .Va errno | 125 | .Va errno |
120 | will have been set), or it returns a pointer to the destination string. | 126 | will have been set), or it returns a pointer to the destination string. |
127 | .Pp | ||
121 | The routine | 128 | The routine |
122 | .Fn inet_ntoa | 129 | .Fn inet_ntoa |
123 | takes an Internet address and returns an | 130 | takes an Internet address and returns an |
124 | ASCII string representing the address in dot notation. | 131 | ASCII string representing the address in dot notation. |
132 | .Pp | ||
125 | The routine | 133 | The routine |
126 | .Fn inet_makeaddr | 134 | .Fn inet_makeaddr |
127 | takes an Internet network number and a local | 135 | takes an Internet network number and a local |
128 | network address and constructs an Internet address | 136 | network address and constructs an Internet address |
129 | from it. | 137 | from it. |
138 | .Pp | ||
130 | The routines | 139 | The routines |
131 | .Fn inet_netof | 140 | .Fn inet_netof |
132 | and | 141 | and |
@@ -261,14 +270,6 @@ or in compressed form: | |||
261 | ::FFFF:129.144.52.38 | 270 | ::FFFF:129.144.52.38 |
262 | .Ed | 271 | .Ed |
263 | .El | 272 | .El |
264 | .Sh DIAGNOSTICS | ||
265 | The constant | ||
266 | .Dv INADDR_NONE | ||
267 | is returned by | ||
268 | .Fn inet_addr | ||
269 | and | ||
270 | .Fn inet_network | ||
271 | for malformed requests. | ||
272 | .Sh SEE ALSO | 273 | .Sh SEE ALSO |
273 | .Xr byteorder 3 , | 274 | .Xr byteorder 3 , |
274 | .Xr gethostbyname 3 , | 275 | .Xr gethostbyname 3 , |