1.\" $OpenBSD: ipx.3,v 1.11 2005/06/09 08:40:49 jmc Exp $ 2.\" 3.\" Copyright (c) 1986, 1991, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.Dd June 4, 1993 31.Dt IPX 3 32.Os 33.Sh NAME 34.Nm ipx_addr , 35.Nm ipx_ntoa 36.Nd IPX address conversion routines 37.Sh SYNOPSIS 38.Fd #include <sys/types.h> 39.Fd #include <netipx/ipx.h> 40.Ft struct ipx_addr 41.Fn ipx_addr "const char *cp" 42.Ft char * 43.Fn ipx_ntoa "struct ipx_addr ipx" 44.Sh DESCRIPTION 45The routine 46.Fn ipx_addr 47interprets character strings representing 48.Tn IPX 49addresses, returning binary information suitable 50for use in system calls. 51The routine 52.Fn ipx_ntoa 53takes 54.Tn IPX 55addresses and returns 56.Tn ASCII 57strings representing the address in a 58notation in common use: 59.Bd -filled -offset indent 60<network number>.<host number>.<port number> 61.Ed 62.Pp 63Trailing zero fields are suppressed, and each number is printed in hexadecimal, 64in a format suitable for input to 65.Fn ipx_addr . 66Any fields lacking super-decimal digits will have a 67trailing 68.Sq H 69appended. 70.Pp 71An effort has been made to ensure that 72.Fn ipx_addr 73be compatible with most formats in common use. 74It will first separate an address into 1 to 3 fields using a single delimiter 75chosen from 76period 77.Pq Ql \&. , 78colon 79.Pq Ql \&: , 80or pound-sign 81.Pq Ql # . 82Each field is then examined for byte separators (colon or period). 83If there are byte separators, each subfield separated is taken to be 84a small hexadecimal number, and the entirety is taken as a network-byte-ordered 85quantity to be zero extended in the high-network-order bytes. 86Next, the field is inspected for hyphens, in which case 87the field is assumed to be a number in decimal notation 88with hyphens separating the millenia. 89Next, the field is assumed to be a number: 90It is interpreted 91as hexadecimal if there is a leading 92.Ql 0x 93(as in C), 94a trailing 95.Sq H 96(as in Mesa), or there are any super-decimal digits present. 97It is interpreted as octal if there is a leading 98.Ql 0 99and there are no super-octal digits. 100Otherwise, it is converted as a decimal number. 101.Sh RETURN VALUES 102None. 103(See 104.Sx BUGS . ) 105.Sh SEE ALSO 106.Xr hosts 5 , 107.Xr networks 5 108.Sh HISTORY 109The precursor 110.Fn ns_addr 111and 112.Fn ns_ntoa 113functions appeared in 114.Bx 4.3 . 115.Sh BUGS 116The string returned by 117.Fn ipx_ntoa 118resides in a static memory area. 119The function 120.Fn ipx_addr 121should diagnose improperly formed input, and there should be an unambiguous 122way to recognize this. 123