Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libutil Formatting fixes, and a typo fix.
details: https://anonhg.NetBSD.org/src/rev/2485436d5a1c
branches: trunk
changeset: 571372:2485436d5a1c
user: wiz <wiz%NetBSD.org@localhost>
date: Sat Nov 20 23:29:33 2004 +0000
description:
Formatting fixes, and a typo fix.
diffstat:
lib/libutil/sockaddr_snprintf.3 | 55 +++++++++++++++++++++-------------------
1 files changed, 29 insertions(+), 26 deletions(-)
diffs (162 lines):
diff -r b9049c62b2c7 -r 2485436d5a1c lib/libutil/sockaddr_snprintf.3
--- a/lib/libutil/sockaddr_snprintf.3 Sat Nov 20 19:56:44 2004 +0000
+++ b/lib/libutil/sockaddr_snprintf.3 Sat Nov 20 23:29:33 2004 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: sockaddr_snprintf.3,v 1.1 2004/11/20 03:06:09 christos Exp $
+.\" $NetBSD: sockaddr_snprintf.3,v 1.2 2004/11/20 23:29:33 wiz Exp $
.\"
.\" Copyright (c) 2004 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -35,7 +35,7 @@
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd November 19, 2004
-.Dt SOCKADDR_SNPRINTF 8
+.Dt SOCKADDR_SNPRINTF 3
.Os
.Sh NAME
.Nm sockaddr_snprintf
@@ -43,7 +43,7 @@
.Sh SYNOPSIS
.In util.h
.Ft int
-.Fn "sockaddr_snprintf" "char *buf" "size_t buflen" "const char *fmt" "const struct sockaddr *sa"
+.Fn sockaddr_snprintf "char *buf" "size_t buflen" "const char *fmt" "const struct sockaddr *sa"
.Sh DESCRIPTION
The
.Fn sockaddr_snprintf
@@ -56,7 +56,7 @@
like format string specifies how the address is going to be printed.
Some formatting characters are only supported by some address families.
If a certain formatting character is not supported, then the string
-.Dt N/A
+.Dq N/A
is printed.
.Pp
The resulting formatted string is placed into
@@ -66,35 +66,38 @@
characters are placed in
.Fa buf .
.Pp
-The following formatting characters are supported:
+The following formatting characters are supported (immediately
+after a percent
+.Pq Sq %
+sign):
.Bl -tag -width %a
.It a
The node address portion of the socket address is printed numerically.
For
.Dv AF_INET
the address is printed as:
-.Dv A.B.C.D
+.Dq A.B.C.D
and
for AF_INET6
the address is printed as:
-.Dv A:B...[%if]
+.Dq A:B...[%if]
using
-.Xr getnameinfo
+.Xr getnameinfo 3
internally with
.Dv NI_NUMERICHOST .
-For
+For
.Dv AF_APPLETALK
the address is printed as:
-.Dv A.B
+.Dq A.B
For
.Dv AF_LOCAL
-.Dv ( AF_UNIX )
+.Pq Dv AF_UNIX
the address is printed as:
-.Dv socket-path
+.Dq socket-path
For
.Dv AF_LINK
the address is printed as:
-.Dv a.b.c.d.e.f
+.Dq a.b.c.d.e.f
using
.Xr link_ntoa 3 ,
but the interface portion is skipped (see below).
@@ -124,7 +127,7 @@
For
.Dv AF_APPLETALK
addresses, the netrange portion of the address is printed as:
-.Dv phase:[firstnet,lastnet]
+.Dq phase:[firstnet,lastnet]
.It S
For
.Dv AF_INET6
@@ -132,7 +135,7 @@
.El
.Sh RETURN VALUES
The
-.Fn sockaddr_snprintf
+.Fn sockaddr_snprintf
function returns the number of characters that are required to format the
value
.Fa val
@@ -144,9 +147,9 @@
is always NUL-terminated.
If the address family is not supported,
.Fn sockaddr_snprintf
-returns -1 and sets
-.Fa errno
-to
+returns \-1 and sets
+.Va errno
+to
.Dv EAFNOSUPPORT .
For
.Dv AF_INET
@@ -154,7 +157,7 @@
.DV AF_INET6
addresses
.Fn sockaddr_snprintf
-returns -1 if the
+returns \-1 if the
.Xr getnameinfo 3
conversion failed, and
.Fa errno
@@ -167,14 +170,14 @@
.Fn sockaddr_snprintf
will still return the buffer, containing a truncated string.
.Sh SEE ALSO
-.Xr getnameinfo 3
-.Xr link_ntoa 3
+.Xr getnameinfo 3 ,
+.Xr link_ntoa 3 ,
.Xr snprintf 3
.Sh HISTORY
The
.Fn sockaddr_snprintf
first appeared in
-.Nx 3.0
+.Nx 3.0 .
.Sh BUGS
The
.Fn sockaddr_snprintf
@@ -185,9 +188,9 @@
For example it would be useful to print
.Dv AF_LINK
addresses as
-.Dv %.2x:%.2x...
+.Dq %.2x:%.2x...
instead of
-.Dv %x.%x...
+.Dq %x.%x...
.Pp
This function is supposed to be quick, but
.Xr getnameinfo 3
@@ -195,5 +198,5 @@
.Pp
Not all formatting characters are supported by all address families and
printing
-.Dv N/A
-is not very conventient.
+.Dq N/A
+is not very convenient.
Home |
Main Index |
Thread Index |
Old Index