Fri Jul 20 13:40:58 2012 UTC ()
- Use .Vt for variable types outside the SYNOPSIS section rather than .Ft
- Use .Fn for function names outside the NAME section rather than .Nm
- Mark NULL as a defined value (.Dv)
- New sentence new line
- Don't start sentences with an arugment name
- Use \- rather than a bare - for a minus sign
- Spelling: rightmost
- Stray whitespace
  (Most changes from FreeBSD)


(ginsbach)
diff -r1.2 -r1.3 src/lib/libc/inet/inet_net.3

cvs diff -r1.2 -r1.3 src/lib/libc/inet/inet_net.3 (expand / switch to unified diff)

--- src/lib/libc/inet/inet_net.3 2008/04/30 13:10:50 1.2
+++ src/lib/libc/inet/inet_net.3 2012/07/20 13:40:58 1.3
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: inet_net.3,v 1.2 2008/04/30 13:10:50 martin Exp $ 1.\" $NetBSD: inet_net.3,v 1.3 2012/07/20 13:40:58 ginsbach Exp $
2.\" 2.\"
3.\" Copyright (c) 1997 The NetBSD Foundation, Inc. 3.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation 6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Luke Mewburn. 7.\" by Luke Mewburn.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions 10.\" modification, are permitted provided that the following conditions
11.\" are met: 11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright 12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer. 13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" 2. Redistributions in binary form must reproduce the above copyright
@@ -38,117 +38,121 @@ @@ -38,117 +38,121 @@
38.Lb libc 38.Lb libc
39.Sh SYNOPSIS 39.Sh SYNOPSIS
40.In sys/socket.h 40.In sys/socket.h
41.In netinet/in.h 41.In netinet/in.h
42.In arpa/inet.h 42.In arpa/inet.h
43.Ft char * 43.Ft char *
44.Fn inet_net_ntop "int af" "const void *src" "int bits" "char *dst" "size_t size" 44.Fn inet_net_ntop "int af" "const void *src" "int bits" "char *dst" "size_t size"
45.Ft int 45.Ft int
46.Fn inet_net_pton "int af" "const char *src" "void *dst" "size_t size" 46.Fn inet_net_pton "int af" "const char *src" "void *dst" "size_t size"
47.Sh DESCRIPTION 47.Sh DESCRIPTION
48The 48The
49.Fn inet_net_ntop 49.Fn inet_net_ntop
50function converts an Internet network number from network format (usually a 50function converts an Internet network number from network format (usually a
51.Ft struct in_addr 51.Vt struct in_addr
52or some other binary form, in network byte order) to CIDR presentation format 52or some other binary form, in network byte order) to CIDR presentation format
53(suitable for external display purposes). 53(suitable for external display purposes).
 54The
54.Fa bits 55.Fa bits
55is the number of bits in 56argument is the number of bits in
56.Fa src 57.Fa src
57that are the network number. 58that are the network number.
58It returns NULL if a system error occurs (in which case, 59It returns
 60.Dv NULL
 61if a system error occurs (in which case,
59.Va errno 62.Va errno
60will have been set), or it returns a pointer to the destination string. 63will have been set), or it returns a pointer to the destination string.
61.Pp 64.Pp
62The 65The
63.Fn inet_net_pton 66.Fn inet_net_pton
64function converts a presentation format Internet network number (that is, 67function converts a presentation format Internet network number (that is,
65printable form as held in a character string) to network format (usually a 68printable form as held in a character string) to network format (usually a
66.Ft struct in_addr 69.Vt struct in_addr
67or some other internal binary representation, in network byte order). 70or some other internal binary representation, in network byte order).
68It returns the number of bits (either computed based on the class, or 71It returns the number of bits (either computed based on the class, or
69specified with /CIDR), or -1 if a failure occurred 72specified with /CIDR), or \-1 if a failure occurred
70(in which case 73(in which case
71.Va errno 74.Va errno
72will have been set. 75will have been set.
73It will be set to 76It will be set to
74.Er ENOENT 77.Er ENOENT
75if the Internet network number was not valid). 78if the Internet network number was not valid).
76.Pp 79.Pp
77The currently supported values for 80The currently supported values for
78.Fa af 81.Fa af
79are 82are
80.Dv AF_INET 83.Dv AF_INET
81and 84and
82.Dv AF_INET6 . 85.Dv AF_INET6 .
 86The
83.Fa size 87.Fa size
84is the size of the result buffer 88argument is the size of the result buffer
85.Fa dst . 89.Fa dst .
86.Sh NETWORK NUMBERS (IP VERSION 4) 90.Sh NETWORK NUMBERS (IP VERSION 4)
87Internet network numbers may be specified in one of the following forms: 91Internet network numbers may be specified in one of the following forms:
88.Bd -literal -offset indent 92.Bd -literal -offset indent
89a.b.c.d/bits 93a.b.c.d/bits
90a.b.c.d 94a.b.c.d
91a.b.c 95a.b.c
92a.b 96a.b
93a 97a
94.Ed 98.Ed
95.Pp 99.Pp
96When four parts are specified, each is interpreted 100When four parts are specified, each is interpreted
97as a byte of data and assigned, from left to right, 101as a byte of data and assigned, from left to right,
98to the four bytes of an Internet network number. Note 102to the four bytes of an Internet network number.
99that when an Internet network number is viewed as a 32-bit 103Note that when an Internet network number is viewed as a 32-bit
100integer quantity on a system that uses little-endian 104integer quantity on a system that uses little-endian
101byte order (such as the 105byte order (such as the
102.Tn Intel 386, 486 106.Tn Intel 386 , 486 ,
103and 107and
104.Tn Pentium 108.Tn Pentium
105processors) the bytes referred to above appear as 109processors) the bytes referred to above appear as
106.Dq Li d.c.b.a . 110.Dq Li d.c.b.a .
107That is, little-endian bytes are ordered from right to left. 111That is, little-endian bytes are ordered from right to left.
108.Pp 112.Pp
109When a three part number is specified, the last 113When a three part number is specified, the last
110part is interpreted as a 16-bit quantity and placed 114part is interpreted as a 16-bit quantity and placed
111in the right-most two bytes of the Internet network number. 115in the rightmost two bytes of the Internet network number.
112This makes the three part number format convenient 116This makes the three part number format convenient
113for specifying Class B network numbers as 117for specifying Class B network numbers as
114.Dq Li 128.net.host . 118.Dq Li 128.net.host .
115.Pp 119.Pp
116When a two part number is supplied, the last part 120When a two part number is supplied, the last part
117is interpreted as a 24-bit quantity and placed in 121is interpreted as a 24-bit quantity and placed in
118the right most three bytes of the Internet network number. 122the rightmost three bytes of the Internet network number.
119This makes the two part number format convenient 123This makes the two part number format convenient
120for specifying Class A network numbers as 124for specifying Class A network numbers as
121.Dq Li net.host . 125.Dq Li net.host .
122.Pp 126.Pp
123When only one part is given, the value is stored 127When only one part is given, the value is stored
124directly in the Internet network number without any byte 128directly in the Internet network number without any byte
125rearrangement. 129rearrangement.
126.Pp 130.Pp
127All numbers supplied as 131All numbers supplied as
128.Dq parts 132.Dq parts
129in a 133in a
130.Ql \&. 134.Ql \&.
131notation 135notation
132may be decimal, octal, or hexadecimal, as specified 136may be decimal, octal, or hexadecimal, as specified
133in the C language (i.e., a leading 0x or 0X implies 137in the C language (i.e., a leading 0x or 0X implies
134hexadecimal; otherwise, a leading 0 implies octal; 138hexadecimal; otherwise, a leading 0 implies octal;
135otherwise, the number is interpreted as decimal). 139otherwise, the number is interpreted as decimal).
136.\" 140.\"
137.\" .Sh NETWORK NUMBERS (IP VERSION 6) 141.\" .Sh NETWORK NUMBERS (IP VERSION 6)
138.\" XXX - document this! 142.\" XXX - document this!
139.\" 143.\"
140.Sh SEE ALSO 144.Sh SEE ALSO
141.Xr byteorder 3 , 145.Xr byteorder 3 ,
142.Xr inet 3 , 146.Xr inet 3 ,
143.Xr networks 5 147.Xr networks 5
144.Sh HISTORY 148.Sh HISTORY
145The 149The
146.Nm inet_net_ntop 150.Fn inet_net_ntop
147and 151and
148.Nm inet_net_pton 152.Fn inet_net_pton
149functions appeared in BIND 4.9.4 and thence 153functions appeared in BIND 4.9.4 and thence
150.Nx 1.3 . 154.Nx 1.3 .
151Support for 155Support for
152.Dv AF_INET6 156.Dv AF_INET6
153appeared in 157appeared in
154.Nx 1.6 . 158.Nx 1.6 .