1NS(3N)                                                                  NS(3N)
2
3
4

NAME

6       ns_addr, ns_ntoa - Xerox NS(tm)  address conversion routines
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <netns/ns.h>
11
12       struct ns_addr ns_addr(cp)
13       char *cp;
14
15       char *ns_ntoa(ns)
16       struct ns_addr ns;
17

DESCRIPTION

19       The  routine  ns_addr  interprets  character  strings  representing XNS
20       addresses, returning binary information  suitable  for  use  in  system
21       calls.   ns_ntoa  takes  XNS addresses and returns ASCII strings repre‐
22       senting the address in a notation in common use in the  Xerox  Develop‐
23       ment Environment:
24            <network number>.<host number>.<port number>
25       Trailing  zero  fields  are  suppressed,  and each number is printed in
26       hexadecimal, in a format suitable for input  to  ns_addr.   Any  fields
27       lacking super-decimal digits will have a trailing ``H'' appended.
28
29       Unfortunately,  no  universal  standard  exists  for  representing  XNS
30       addresses.  An effort has been made to insure that ns_addr be  compati‐
31       ble with most formats in common use.  It will first separate an address
32       into 1 to 3 fields using a single delimiter chosen from period (``.''),
33       colon  (``:'')  or pound-sign (``#'').  Each field is then examined for
34       byte separators (colon or period).  If there are byte separators,  each
35       subfield  separated  is taken to be a small hexadecimal number, and the
36       entirety is  taken  as  a  network-byte-ordered  quantity  to  be  zero
37       extended in the high-network-order bytes.  Next, the field is inspected
38       for hyphens, in which case the field is assumed to be a number in deci‐
39       mal  notation with hyphens separating the millenia.  Next, the field is
40       assumed to be a number: It is interpreted as hexadecimal if there is  a
41       leading  ``0x''  (as in C), a trailing ``H'' (as in Mesa), or there are
42       any super-decimal digits present.  It is interpreted as octal is  there
43       is  a leading ``0'' and there are no super-octal digits.  Otherwise, it
44       is converted as a decimal number.
45

SEE ALSO

47       hosts(5), networks(5),
48

DIAGNOSTICS

50       None (see BUGS).
51

BUGS

53       The string returned by ns_ntoa resides in a static memory area.
54       ns_addr should diagnose improperly formed input, and there should be an
55       unambiguous way to recognize this.
56
57
58
594.3 Berkeley Distribution        May 12, 1986                           NS(3N)
Impressum