add FD_SET for 4.2BSD sites
[unix-history] / usr / src / lib / libc / net / ns.3
CommitLineData
78e649e1
KM
1.\" Copyright (c) 1986 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
a7b6cc8d 5.\" @(#)ns.3 6.2 (Berkeley) %G%
78e649e1
KM
6.\"
7.TH NS 3N ""
8.UC 6
9.SH NAME
10ns_addr, ns_ntoa \- Xerox NS(tm) address conversion routines
11.SH SYNOPSIS
12.nf
13.B "#include <sys/types.h>
14.B "#include <netns/ns.h>
15.PP
16.B "struct ns_addr ns_addr(cp)
17.B "char *cp;
18.PP
19.B "char *ns_ntoa(ns)
20.B "struct ns_addr ns;
21.fi
22.SH DESCRIPTION
23The routine
a7b6cc8d 24.I ns_addr
78e649e1
KM
25interprets character strings representing
26XNS addresses, returning binary information suitable
27for use in system calls.
a7b6cc8d 28.I ns_ntoa
78e649e1
KM
29takes XNS addresses and returns ASCII
30strings representing the address in a
31notation in common use in the Xerox Development Environment:
32.nf
33 <network number>.<host number>.<port number>
34.fi
35Trailing zero fields are suppressed, and each number is printed in hexadecimal,
a7b6cc8d
MK
36in a format suitable for input to
37.IR ns_addr .
78e649e1 38Any fields lacking super-decimal digits will have a
a7b6cc8d 39trailing ``H'' appended.
78e649e1
KM
40.PP
41Unfortunately, no universal standard exists for representing XNS addresses.
42An effort has been made to insure that
a7b6cc8d 43.I ns_addr
78e649e1
KM
44be compatible with most formats in common use.
45It will first separate an address into 1 to 3 fields using a single delimiter
46chosen from
47period (``.''),
48colon (``:'') or pound-sign (``#'').
a7b6cc8d 49Each field is then examined for byte separators (colon or period).
78e649e1
KM
50If there are byte separators, each subfield separated is taken to be
51a small hexadecimal number, and the entirety is taken as a network-byte-ordered
52quantity to be zero extended in the high-network-order bytes.
53Next, the field is inspected for hyphens, in which case
54the field is assumed to be a number in decimal notation
55with hyphens separating the millenia.
56Next, the field is assumed to be a number:
57It is interpreted
58as hexadecimal if there is a leading ``0x'' (as in C),
a7b6cc8d
MK
59a trailing ``H'' (as in Mesa), or there are any super-decimal digits present.
60It is interpreted as octal is there is a leading ``0''
61and there are no super-octal digits.
78e649e1
KM
62Otherwise, it is converted as a decimal number.
63.SH "SEE ALSO"
64hosts(5), networks(5),
65.SH DIAGNOSTICS
66None (see BUGS).
67.SH BUGS
68The string returned by
69.I ns_ntoa
70resides in a static memory area.
71.br
72.I ns_addr
73should diagnose improperly formed input, and there should be an unambiguous
74way to recognize this.