ns_addr(3) — Subroutines
OSF
NAME
ns_addr, ns_ntoa − Xerox NS address conversion routines
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <sys/types.h>
#include <netns/ns.h> struct ns_addr ns_addr(
char ∗cp ); char ∗ns_ntoa(
struct ns_addr ns );
PARAMETERS
cpPoints to a character string representing an XNS address.
nsSpecifies an XNS address.
DESCRIPTION
The ns_addr() function interprets character strings representing Xerox NS addresses, and returns binary information suitable for use in functions. The ns_ntoa() function takes XNS addresses and returns ASCII strings representing the address in a notation in common use in the Xerox development environment:
<network number>.<host number>.<port number>
Trailing zero fields are suppressed, and each number is printed in hexadecimal, in a format suitable for input to the ns_addr() function. Any fields lacking superdecimal digits will have a trailing “H” appended.
Unfortunately, no universal standard exists for representing XNS addresses. An effort has been made to insure that the ns_addr() function be compatible with most formats in common use.
The ns_addr() function first separates an address into one to three fields using a . (period), a : (colon), or a # (number sign) single delimiter. Each field is then examined for byte separators (colon or period). If there are byte separators, each subfield separated is taken to be a small hexadecimal number, and the entirety is taken as a network-byte-ordered quantity to be zero extended in the high-network-order bytes.
Next, the field is inspected for hyphens. If there are hyphens, the field is assumed to be a number in decimal notation with hyphens separating the millenia. Next, the field is assumed to be a number. It is interpreted as hexadecimal if there is a leading "0x" (as in C), a trailing "H" (as in Mesa), or if there are any superdecimal digits present. It is interpreted as octal if there is a leading 0 (zero) and there are no superoctal digits. Otherwise, it is converted as a decimal number.
RELATED INFORMATION
Files: hosts(4), networks(4)