git: 28a8192a34ca - stable/13 - inet(3): clarify syntax accepted by inet_pton

From: Mike Karels <karels_at_FreeBSD.org>
Date: Tue, 30 Jan 2024 20:11:15 UTC
The branch stable/13 has been updated by karels:

URL: https://cgit.FreeBSD.org/src/commit/?id=28a8192a34ca5d428f130330b52c113b475b5756

commit 28a8192a34ca5d428f130330b52c113b475b5756
Author:     Mike Karels <karels@FreeBSD.org>
AuthorDate: 2024-01-27 15:40:07 +0000
Commit:     Mike Karels <karels@FreeBSD.org>
CommitDate: 2024-01-30 20:11:07 +0000

    inet(3): clarify syntax accepted by inet_pton
    
    The section INTERNET ADDRESSES describes the acceptance of dotted
    values with varying number of parts in multiple bases.  This applies
    to inet_aton and inet_addr, but not to inet_pton.  Clarify this
    section by listing the functions to which this applies.  Move the
    description of what inet_pton accepts into this section from STANDARDS,
    where it is easily missed.  Rename the section to clarify that it
    applies only to IPv4.  (inet_pton also works with IPv6.)
    
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D43537
    
    (cherry picked from commit 9231c42127bf8e47588169ecc395f57cae0e15fb)
---
 lib/libc/net/inet.3 | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib/libc/net/inet.3 b/lib/libc/net/inet.3
index 69ccf3df9e77..85b7997d998f 100644
--- a/lib/libc/net/inet.3
+++ b/lib/libc/net/inet.3
@@ -175,10 +175,15 @@ All Internet addresses are returned in network
 order (bytes ordered from left to right).
 All network numbers and local address parts are
 returned as machine byte order integer values.
-.Sh INTERNET ADDRESSES
-Values specified using the
+.Sh INTERNET ADDRESSES (IP VERSION 4)
+The
+.Fn inet_aton 
+and
+.Fn inet_addr
+functions accept IPv4
+values specified using the
 .Ql .\&
-notation take one
+notation in one
 of the following forms:
 .Bd -literal -offset indent
 a.b.c.d
@@ -212,6 +217,13 @@ may be decimal, octal, or hexadecimal, as specified
 in the C language (i.e., a leading 0x or 0X implies
 hexadecimal; otherwise, a leading 0 implies octal;
 otherwise, the number is interpreted as decimal).
+.Pp
+Note that
+.Fn inet_pton
+does not accept 1-, 2-, or 3-part dotted addresses; all four parts
+must be specified and are interpreted only as decimal values.
+This is a narrower input set than that accepted by
+.Fn inet_aton .
 .Sh DIAGNOSTICS
 The constant
 .Dv INADDR_NONE
@@ -258,12 +270,6 @@ and
 .Fn inet_pton
 functions conform to
 .St -xns5.2 .
-Note that
-.Fn inet_pton
-does not accept 1-, 2-, or 3-part dotted addresses; all four parts
-must be specified and are interpreted only as decimal values.
-This is a narrower input set than that accepted by
-.Fn inet_aton .
 .Sh HISTORY
 These
 functions appeared in