Commit | Line | Data |
---|---|---|
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 | |
10 | ns_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 | |
23 | The routine | |
a7b6cc8d | 24 | .I ns_addr |
78e649e1 KM |
25 | interprets character strings representing |
26 | XNS addresses, returning binary information suitable | |
27 | for use in system calls. | |
a7b6cc8d | 28 | .I ns_ntoa |
78e649e1 KM |
29 | takes XNS addresses and returns ASCII |
30 | strings representing the address in a | |
31 | notation in common use in the Xerox Development Environment: | |
32 | .nf | |
33 | <network number>.<host number>.<port number> | |
34 | .fi | |
35 | Trailing zero fields are suppressed, and each number is printed in hexadecimal, | |
a7b6cc8d MK |
36 | in a format suitable for input to |
37 | .IR ns_addr . | |
78e649e1 | 38 | Any fields lacking super-decimal digits will have a |
a7b6cc8d | 39 | trailing ``H'' appended. |
78e649e1 KM |
40 | .PP |
41 | Unfortunately, no universal standard exists for representing XNS addresses. | |
42 | An effort has been made to insure that | |
a7b6cc8d | 43 | .I ns_addr |
78e649e1 KM |
44 | be compatible with most formats in common use. |
45 | It will first separate an address into 1 to 3 fields using a single delimiter | |
46 | chosen from | |
47 | period (``.''), | |
48 | colon (``:'') or pound-sign (``#''). | |
a7b6cc8d | 49 | Each field is then examined for byte separators (colon or period). |
78e649e1 KM |
50 | If there are byte separators, each subfield separated is taken to be |
51 | a small hexadecimal number, and the entirety is taken as a network-byte-ordered | |
52 | quantity to be zero extended in the high-network-order bytes. | |
53 | Next, the field is inspected for hyphens, in which case | |
54 | the field is assumed to be a number in decimal notation | |
55 | with hyphens separating the millenia. | |
56 | Next, the field is assumed to be a number: | |
57 | It is interpreted | |
58 | as hexadecimal if there is a leading ``0x'' (as in C), | |
a7b6cc8d MK |
59 | a trailing ``H'' (as in Mesa), or there are any super-decimal digits present. |
60 | It is interpreted as octal is there is a leading ``0'' | |
61 | and there are no super-octal digits. | |
78e649e1 KM |
62 | Otherwise, it is converted as a decimal number. |
63 | .SH "SEE ALSO" | |
64 | hosts(5), networks(5), | |
65 | .SH DIAGNOSTICS | |
66 | None (see BUGS). | |
67 | .SH BUGS | |
68 | The string returned by | |
69 | .I ns_ntoa | |
70 | resides in a static memory area. | |
71 | .br | |
72 | .I ns_addr | |
73 | should diagnose improperly formed input, and there should be an unambiguous | |
74 | way to recognize this. |