|
|
1.1 ! root 1: .\" Copyright (c) 1986 The Regents of the University of California. ! 2: .\" All rights reserved. ! 3: .\" ! 4: .\" Redistribution and use in source and binary forms are permitted provided ! 5: .\" that: (1) source distributions retain this entire copyright notice and ! 6: .\" comment, and (2) distributions including binaries display the following ! 7: .\" acknowledgement: ``This product includes software developed by the ! 8: .\" University of California, Berkeley and its contributors'' in the ! 9: .\" documentation or other materials provided with the distribution and in ! 10: .\" all advertising materials mentioning features or use of this software. ! 11: .\" Neither the name of the University nor the names of its contributors may ! 12: .\" be used to endorse or promote products derived from this software without ! 13: .\" specific prior written permission. ! 14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 17: .\" ! 18: .\" @(#)ns.3 6.4 (Berkeley) 6/23/90 ! 19: .\" ! 20: .TH NS 3 "June 23, 1990" ! 21: .UC 6 ! 22: .SH NAME ! 23: ns_addr, ns_ntoa \- Xerox NS(tm) address conversion routines ! 24: .SH SYNOPSIS ! 25: .nf ! 26: .B "#include <sys/types.h> ! 27: .B "#include <netns/ns.h> ! 28: .PP ! 29: .B "struct ns_addr ns_addr(cp) ! 30: .B "char *cp; ! 31: .PP ! 32: .B "char *ns_ntoa(ns) ! 33: .B "struct ns_addr ns; ! 34: .fi ! 35: .SH DESCRIPTION ! 36: The routine ! 37: .I ns_addr ! 38: interprets character strings representing ! 39: XNS addresses, returning binary information suitable ! 40: for use in system calls. ! 41: .I ns_ntoa ! 42: takes XNS addresses and returns ASCII ! 43: strings representing the address in a ! 44: notation in common use in the Xerox Development Environment: ! 45: .nf ! 46: <network number>.<host number>.<port number> ! 47: .fi ! 48: Trailing zero fields are suppressed, and each number is printed in hexadecimal, ! 49: in a format suitable for input to ! 50: .IR ns_addr . ! 51: Any fields lacking super-decimal digits will have a ! 52: trailing ``H'' appended. ! 53: .PP ! 54: Unfortunately, no universal standard exists for representing XNS addresses. ! 55: An effort has been made to insure that ! 56: .I ns_addr ! 57: be compatible with most formats in common use. ! 58: It will first separate an address into 1 to 3 fields using a single delimiter ! 59: chosen from ! 60: period (``.''), ! 61: colon (``:'') or pound-sign (``#''). ! 62: Each field is then examined for byte separators (colon or period). ! 63: If there are byte separators, each subfield separated is taken to be ! 64: a small hexadecimal number, and the entirety is taken as a network-byte-ordered ! 65: quantity to be zero extended in the high-network-order bytes. ! 66: Next, the field is inspected for hyphens, in which case ! 67: the field is assumed to be a number in decimal notation ! 68: with hyphens separating the millenia. ! 69: Next, the field is assumed to be a number: ! 70: It is interpreted ! 71: as hexadecimal if there is a leading ``0x'' (as in C), ! 72: a trailing ``H'' (as in Mesa), or there are any super-decimal digits present. ! 73: It is interpreted as octal is there is a leading ``0'' ! 74: and there are no super-octal digits. ! 75: Otherwise, it is converted as a decimal number. ! 76: .SH "SEE ALSO" ! 77: hosts(5), networks(5), ! 78: .SH DIAGNOSTICS ! 79: None (see BUGS). ! 80: .SH BUGS ! 81: The string returned by ! 82: .I ns_ntoa ! 83: resides in a static memory area. ! 84: .br ! 85: .I ns_addr ! 86: should diagnose improperly formed input, and there should be an unambiguous ! 87: way to recognize this.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.