summaryrefslogtreecommitdiffstats
path: root/man3/inet_net_pton.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/inet_net_pton.3')
-rw-r--r--man3/inet_net_pton.348
1 files changed, 24 insertions, 24 deletions
diff --git a/man3/inet_net_pton.3 b/man3/inet_net_pton.3
index 2a74441..e8264e8 100644
--- a/man3/inet_net_pton.3
+++ b/man3/inet_net_pton.3
@@ -2,7 +2,7 @@
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
-.TH inet_net_pton 3 2023-05-03 "Linux man-pages 6.05.01"
+.TH inet_net_pton 3 2023-10-31 "Linux man-pages 6.7"
.SH NAME
inet_net_pton, inet_net_ntop \- Internet network number conversion
.SH LIBRARY
@@ -11,7 +11,7 @@ Resolver library
.SH SYNOPSIS
.nf
.B #include <arpa/inet.h>
-.PP
+.P
.BI "int inet_net_pton(int " af ", const char *" pres ,
.BI " void " netp [. nsize "], size_t " nsize );
.BI "char *inet_net_ntop(int " af ,
@@ -19,12 +19,12 @@ Resolver library
.BI " int " bits ,
.BI " char " pres [. psize "], size_t " psize );
.fi
-.PP
+.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
-.PP
+.P
.BR inet_net_pton (),
.BR inet_net_ntop ():
.nf
@@ -36,7 +36,7 @@ Feature Test Macro Requirements for glibc (see
.SH DESCRIPTION
These functions convert network numbers between
presentation (i.e., printable) format and network (i.e., binary) format.
-.PP
+.P
For both functions,
.I af
specifies the address family for the conversion;
@@ -61,7 +61,7 @@ The
.I nsize
argument specifies the number of bytes available in
.IR netp .
-.PP
+.P
On success,
.BR inet_net_pton ()
returns the number of bits in the network number field
@@ -69,7 +69,7 @@ of the result placed in
.IR netp .
For a discussion of the input presentation format and the return value,
see NOTES.
-.PP
+.P
.IR Note :
the buffer pointed to by
.I netp
@@ -91,7 +91,7 @@ The
.I bits
argument specifies the number of bits in the network number in
.IR *netp .
-.PP
+.P
The null-terminated presentation-format string
is placed in the buffer pointed to by
.IR pres .
@@ -109,7 +109,7 @@ returns the number of bits in the network number.
On error, it returns \-1, and
.I errno
is set to indicate the error.
-.PP
+.P
On success,
.BR inet_net_ntop ()
returns
@@ -138,16 +138,16 @@ None.
The network number may be specified either
as a hexadecimal value
or in dotted-decimal notation.
-.PP
+.P
Hexadecimal values are indicated by an initial "0x" or "0X".
The hexadecimal digits populate the nibbles (half octets) of the
network number from left to right in network byte order.
.\" If the hexadecimal string is short, the remaining nibbles are zeroed.
-.PP
+.P
In dotted-decimal notation, up to four octets are specified,
as decimal numbers separated by dots.
Thus, any of the following forms are accepted:
-.PP
+.P
.in +4n
.EX
a.b.c.d
@@ -156,7 +156,7 @@ a.b
a
.EE
.in
-.PP
+.P
Each part is a number in the range 0 to 255 that
populates one byte of the resulting network number,
going from left to right, in network-byte (big endian) order.
@@ -164,7 +164,7 @@ Where a part is omitted, the resulting byte in the network number is zero.
.\" Reading other man pages, some other implementations treat
.\" 'c' in a.b.c as a 16-bit number that populates right-most two bytes
.\" 'b' in a.b as a 24-bit number that populates right-most three bytes
-.PP
+.P
For either hexadecimal or dotted-decimal format,
the network number can optionally be followed by a slash
and a number in the range 0 to 32,
@@ -210,7 +210,7 @@ is 16.
Otherwise,
.I bits
is 8.
-.PP
+.P
If the resulting
.I bits
value from the above steps is greater than or equal to 8,
@@ -233,7 +233,7 @@ It then uses
.BR inet_net_ntop ()
to convert the binary form back to presentation format,
and displays the resulting string.
-.PP
+.P
In order to demonstrate that
.BR inet_net_pton ()
may not write to all bytes of its
@@ -247,11 +247,11 @@ the program displays all of the bytes of the buffer returned by
.BR inet_net_pton ()
allowing the user to see which bytes have not been touched by
.BR inet_net_pton ().
-.PP
+.P
An example run, showing that
.BR inet_net_pton ()
infers the number of bits in the network number:
-.PP
+.P
.in +4n
.EX
$ \fB./a.out 193.168\fP
@@ -260,11 +260,11 @@ inet_net_ntop() yielded: 193.168.0/24
Raw address: c1a80000
.EE
.in
-.PP
+.P
Demonstrate that
.BR inet_net_pton ()
does not zero out unused bytes in its result buffer:
-.PP
+.P
.in +4n
.EX
$ \fB./a.out 193.168 0xffffffff\fP
@@ -273,13 +273,13 @@ inet_net_ntop() yielded: 193.168.0/24
Raw address: c1a800ff
.EE
.in
-.PP
+.P
Demonstrate that
.BR inet_net_pton ()
will widen the inferred size of the network number,
if the supplied number of bytes in the presentation
string exceeds the inferred value:
-.PP
+.P
.in +4n
.EX
$ \fB./a.out 193.168.1.128\fP
@@ -288,13 +288,13 @@ inet_net_ntop() yielded: 193.168.1.128/32
Raw address: c1a80180
.EE
.in
-.PP
+.P
Explicitly specifying the size of the network number overrides any
inference about its size
(but any extra bytes that are explicitly specified will still be used by
.BR inet_net_pton ():
to populate the result buffer):
-.PP
+.P
.in +4n
.EX
$ \fB./a.out 193.168.1.128/24\fP