fix oops in MLINKS for link_addr.3
[unix-history] / usr / src / lib / libc / net / ns.3
CommitLineData
ae59e04c 1.\" Copyright (c) 1986, 1991 The Regents of the University of California.
968d6b3e 2.\" All rights reserved.
78e649e1 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
78e649e1 5.\"
ae59e04c 6.\" @(#)ns.3 6.5 (Berkeley) %G%
968d6b3e 7.\"
ae59e04c
CL
8.Dd
9.Dt NS 3
10.Os BSD 4.3
11.Sh NAME
12.Nm ns_addr ,
13.Nm ns_ntoa
14.Nd Xerox
15.Tn NS Ns (tm)
16address conversion routines
17.Sh SYNOPSIS
18.Fd #include <sys/types.h>
19.Fd #include <netns/ns.h>
20.Ft struct ns_addr
21.Fn ns_addr "char *cp"
22.Ft char *
23.Fn ns_ntoa "struct ns_addr ns"
24.Sh DESCRIPTION
78e649e1 25The routine
ae59e04c 26.Fn ns_addr
78e649e1 27interprets character strings representing
ae59e04c
CL
28.Tn XNS
29addresses, returning binary information suitable
78e649e1 30for use in system calls.
ae59e04c
CL
31The routine
32.Fn ns_ntoa
33takes
34.Tn XNS
35addresses and returns
36.Tn ASCII
78e649e1
KM
37strings representing the address in a
38notation in common use in the Xerox Development Environment:
ae59e04c
CL
39.Bd -filled -offset indent
40<network number>.<host number>.<port number>
41.Ed
42.Pp
78e649e1 43Trailing zero fields are suppressed, and each number is printed in hexadecimal,
a7b6cc8d 44in a format suitable for input to
ae59e04c 45.Fn ns_addr .
78e649e1 46Any fields lacking super-decimal digits will have a
ae59e04c
CL
47trailing
48.Ql H
49appended.
50.Pp
51Unfortunately, no universal standard exists for representing
52.Tn XNS
53addresses.
78e649e1 54An effort has been made to insure that
ae59e04c 55.Fn ns_addr
78e649e1
KM
56be compatible with most formats in common use.
57It will first separate an address into 1 to 3 fields using a single delimiter
58chosen from
ae59e04c
CL
59period
60.Ql \&. ,
61colon
62.Ql \&:
63or pound-sign
64.Ql \&# .
a7b6cc8d 65Each field is then examined for byte separators (colon or period).
78e649e1
KM
66If there are byte separators, each subfield separated is taken to be
67a small hexadecimal number, and the entirety is taken as a network-byte-ordered
68quantity to be zero extended in the high-network-order bytes.
69Next, the field is inspected for hyphens, in which case
70the field is assumed to be a number in decimal notation
71with hyphens separating the millenia.
72Next, the field is assumed to be a number:
73It is interpreted
ae59e04c
CL
74as hexadecimal if there is a leading
75.Ql 0x
76(as in C),
77a trailing
78.Ql H
79(as in Mesa), or there are any super-decimal digits present.
80It is interpreted as octal is there is a leading
81.Ql 0
a7b6cc8d 82and there are no super-octal digits.
78e649e1 83Otherwise, it is converted as a decimal number.
ae59e04c
CL
84.Sh RETURN VALUES
85None. (See
86.Sx BUGS . )
87.Sh SEE ALSO
88.Xr hosts 5 ,
89.Xr networks 5 ,
90.Sh HISTORY
91The
92.Fn ns_addr
93and
94.Fn ns_toa
95functions appeared in
96.Bx 4.3 .
97.Sh BUGS
78e649e1 98The string returned by
ae59e04c 99.Fn ns_ntoa
78e649e1 100resides in a static memory area.
ae59e04c
CL
101The function
102.Fn ns_addr
78e649e1
KM
103should diagnose improperly formed input, and there should be an unambiguous
104way to recognize this.