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