diff options
| author | henning <> | 2007-06-05 18:04:46 +0000 |
|---|---|---|
| committer | henning <> | 2007-06-05 18:04:46 +0000 |
| commit | c077683d6b12ed7a0bd8ef024abfedf5970eee5b (patch) | |
| tree | f0303de4ec8408445ef8f1422e0ad1d201852df2 /src/lib/libc | |
| parent | e021d0a0d5401ab3c1c88e4570ee8c832a47033b (diff) | |
| download | openbsd-c077683d6b12ed7a0bd8ef024abfedf5970eee5b.tar.gz openbsd-c077683d6b12ed7a0bd8ef024abfedf5970eee5b.tar.bz2 openbsd-c077683d6b12ed7a0bd8ef024abfedf5970eee5b.zip | |
remove ipx-related stuff. objections nobody. major bump by kurt in a few
Diffstat (limited to 'src/lib/libc')
| -rw-r--r-- | src/lib/libc/net/Makefile.inc | 7 | ||||
| -rw-r--r-- | src/lib/libc/net/ipx.3 | 122 | ||||
| -rw-r--r-- | src/lib/libc/net/ipx_addr.c | 213 | ||||
| -rw-r--r-- | src/lib/libc/net/ipx_ntoa.c | 46 |
4 files changed, 3 insertions, 385 deletions
diff --git a/src/lib/libc/net/Makefile.inc b/src/lib/libc/net/Makefile.inc index 39d441a96a..7599f02832 100644 --- a/src/lib/libc/net/Makefile.inc +++ b/src/lib/libc/net/Makefile.inc | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.43 2006/12/09 01:12:28 itojun Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.44 2007/06/05 18:04:46 henning Exp $ |
| 2 | 2 | ||
| 3 | # net sources | 3 | # net sources |
| 4 | .PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/net ${LIBCSRCDIR}/net | 4 | .PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/net ${LIBCSRCDIR}/net |
| @@ -12,7 +12,7 @@ SRCS+= base64.c freeaddrinfo.c gai_strerror.c getaddrinfo.c gethostnamadr.c \ | |||
| 12 | herror.c if_indextoname.c if_nameindex.c if_nametoindex.c inet_addr.c \ | 12 | herror.c if_indextoname.c if_nameindex.c if_nametoindex.c inet_addr.c \ |
| 13 | inet_lnaof.c inet_makeaddr.c inet_neta.c inet_netof.c inet_network.c \ | 13 | inet_lnaof.c inet_makeaddr.c inet_neta.c inet_netof.c inet_network.c \ |
| 14 | inet_net_ntop.c inet_net_pton.c inet_ntoa.c inet_ntop.c inet_pton.c \ | 14 | inet_net_ntop.c inet_net_pton.c inet_ntoa.c inet_ntop.c inet_pton.c \ |
| 15 | ipx_addr.c ipx_ntoa.c linkaddr.c net_addrcmp.c nsap_addr.c \ | 15 | linkaddr.c net_addrcmp.c nsap_addr.c \ |
| 16 | rcmd.c rresvport.c recv.c res_comp.c res_data.c res_debug.c \ | 16 | rcmd.c rresvport.c recv.c res_comp.c res_data.c res_debug.c \ |
| 17 | res_debug_syms.c \ | 17 | res_debug_syms.c \ |
| 18 | res_init.c res_mkquery.c res_query.c res_random.c res_send.c send.c \ | 18 | res_init.c res_mkquery.c res_query.c res_random.c res_send.c send.c \ |
| @@ -32,7 +32,7 @@ MAN+= byteorder.3 ethers.3 gai_strerror.3 getaddrinfo.3 gethostbyname.3 \ | |||
| 32 | getrrsetbyname.3 getservent.3 if_indextoname.3 inet.3 \ | 32 | getrrsetbyname.3 getservent.3 if_indextoname.3 inet.3 \ |
| 33 | inet_net.3 inet6_option_space.3 inet6_rthdr_space.3 \ | 33 | inet_net.3 inet6_option_space.3 inet6_rthdr_space.3 \ |
| 34 | inet6_opt_init.3 inet6_rth_space.3 \ | 34 | inet6_opt_init.3 inet6_rth_space.3 \ |
| 35 | ipx.3 link_addr.3 net_addrcmp.3 \ | 35 | link_addr.3 net_addrcmp.3 \ |
| 36 | rcmd.3 rcmdsh.3 resolver.3 | 36 | rcmd.3 rcmdsh.3 resolver.3 |
| 37 | 37 | ||
| 38 | MLINKS+=byteorder.3 htonl.3 byteorder.3 htons.3 byteorder.3 ntohl.3 \ | 38 | MLINKS+=byteorder.3 htonl.3 byteorder.3 htons.3 byteorder.3 ntohl.3 \ |
| @@ -70,7 +70,6 @@ MLINKS+=inet.3 addr.3 inet.3 inet_addr.3 inet.3 inet_aton.3 \ | |||
| 70 | inet.3 ntoa.3 inet.3 inet_ntop.3 inet.3 inet_pton.3 | 70 | inet.3 ntoa.3 inet.3 inet_ntop.3 inet.3 inet_pton.3 |
| 71 | MLINKS+=inet_net.3 inet_net_ntop.3 inet_net.3 inet_net_pton.3 | 71 | MLINKS+=inet_net.3 inet_net_ntop.3 inet_net.3 inet_net_pton.3 |
| 72 | MLINKS+=link_addr.3 link_ntoa.3 | 72 | MLINKS+=link_addr.3 link_ntoa.3 |
| 73 | MLINKS+=ipx.3 ipx_addr.3 ipx.3 ipx_ntoa.3 | ||
| 74 | MLINKS+=rcmd.3 iruserok.3 rcmd.3 rresvport.3 rcmd.3 ruserok.3 \ | 73 | MLINKS+=rcmd.3 iruserok.3 rcmd.3 rresvport.3 rcmd.3 ruserok.3 \ |
| 75 | rcmd.3 rresvport_af.3 rcmd.3 rcmd_af.3 rcmd.3 iruserok_sa.3 | 74 | rcmd.3 rresvport_af.3 rcmd.3 rcmd_af.3 rcmd.3 iruserok_sa.3 |
| 76 | MLINKS+=resolver.3 dn_comp.3 resolver.3 dn_expand.3 resolver.3 res_init.3 \ | 75 | MLINKS+=resolver.3 dn_comp.3 resolver.3 dn_expand.3 resolver.3 res_init.3 \ |
diff --git a/src/lib/libc/net/ipx.3 b/src/lib/libc/net/ipx.3 deleted file mode 100644 index a0b0748e67..0000000000 --- a/src/lib/libc/net/ipx.3 +++ /dev/null | |||
| @@ -1,122 +0,0 @@ | |||
| 1 | .\" $OpenBSD: ipx.3,v 1.12 2007/05/31 19:19:30 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 $Mdocdate: May 31 2007 $ | ||
| 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 | ||
| 45 | The routine | ||
| 46 | .Fn ipx_addr | ||
| 47 | interprets character strings representing | ||
| 48 | .Tn IPX | ||
| 49 | addresses, returning binary information suitable | ||
| 50 | for use in system calls. | ||
| 51 | The routine | ||
| 52 | .Fn ipx_ntoa | ||
| 53 | takes | ||
| 54 | .Tn IPX | ||
| 55 | addresses and returns | ||
| 56 | .Tn ASCII | ||
| 57 | strings representing the address in a | ||
| 58 | notation in common use: | ||
| 59 | .Bd -filled -offset indent | ||
| 60 | <network number>.<host number>.<port number> | ||
| 61 | .Ed | ||
| 62 | .Pp | ||
| 63 | Trailing zero fields are suppressed, and each number is printed in hexadecimal, | ||
| 64 | in a format suitable for input to | ||
| 65 | .Fn ipx_addr . | ||
| 66 | Any fields lacking super-decimal digits will have a | ||
| 67 | trailing | ||
| 68 | .Sq H | ||
| 69 | appended. | ||
| 70 | .Pp | ||
| 71 | An effort has been made to ensure that | ||
| 72 | .Fn ipx_addr | ||
| 73 | be compatible with most formats in common use. | ||
| 74 | It will first separate an address into 1 to 3 fields using a single delimiter | ||
| 75 | chosen from | ||
| 76 | period | ||
| 77 | .Pq Ql \&. , | ||
| 78 | colon | ||
| 79 | .Pq Ql \&: , | ||
| 80 | or pound-sign | ||
| 81 | .Pq Ql # . | ||
| 82 | Each field is then examined for byte separators (colon or period). | ||
| 83 | If there are byte separators, each subfield separated is taken to be | ||
| 84 | a small hexadecimal number, and the entirety is taken as a network-byte-ordered | ||
| 85 | quantity to be zero extended in the high-network-order bytes. | ||
| 86 | Next, the field is inspected for hyphens, in which case | ||
| 87 | the field is assumed to be a number in decimal notation | ||
| 88 | with hyphens separating the millenia. | ||
| 89 | Next, the field is assumed to be a number: | ||
| 90 | It is interpreted | ||
| 91 | as hexadecimal if there is a leading | ||
| 92 | .Ql 0x | ||
| 93 | (as in C), | ||
| 94 | a trailing | ||
| 95 | .Sq H | ||
| 96 | (as in Mesa), or there are any super-decimal digits present. | ||
| 97 | It is interpreted as octal if there is a leading | ||
| 98 | .Ql 0 | ||
| 99 | and there are no super-octal digits. | ||
| 100 | Otherwise, it is converted as a decimal number. | ||
| 101 | .Sh RETURN VALUES | ||
| 102 | None. | ||
| 103 | (See | ||
| 104 | .Sx BUGS . ) | ||
| 105 | .Sh SEE ALSO | ||
| 106 | .Xr hosts 5 , | ||
| 107 | .Xr networks 5 | ||
| 108 | .Sh HISTORY | ||
| 109 | The precursor | ||
| 110 | .Fn ns_addr | ||
| 111 | and | ||
| 112 | .Fn ns_ntoa | ||
| 113 | functions appeared in | ||
| 114 | .Bx 4.3 . | ||
| 115 | .Sh BUGS | ||
| 116 | The string returned by | ||
| 117 | .Fn ipx_ntoa | ||
| 118 | resides in a static memory area. | ||
| 119 | The function | ||
| 120 | .Fn ipx_addr | ||
| 121 | should diagnose improperly formed input, and there should be an unambiguous | ||
| 122 | way to recognize this. | ||
diff --git a/src/lib/libc/net/ipx_addr.c b/src/lib/libc/net/ipx_addr.c deleted file mode 100644 index b65d5f6cfd..0000000000 --- a/src/lib/libc/net/ipx_addr.c +++ /dev/null | |||
| @@ -1,213 +0,0 @@ | |||
| 1 | /* $OpenBSD: ipx_addr.c,v 1.8 2005/08/06 20:30:03 espie Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 1986, 1993 | ||
| 4 | * The Regents of the University of California. All rights reserved. | ||
| 5 | * | ||
| 6 | * This code is derived from software contributed to Berkeley by | ||
| 7 | * J.Q. Johnson. | ||
| 8 | * | ||
| 9 | * Redistribution and use in source and binary forms, with or without | ||
| 10 | * modification, are permitted provided that the following conditions | ||
| 11 | * are met: | ||
| 12 | * 1. Redistributions of source code must retain the above copyright | ||
| 13 | * notice, this list of conditions and the following disclaimer. | ||
| 14 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 15 | * notice, this list of conditions and the following disclaimer in the | ||
| 16 | * documentation and/or other materials provided with the distribution. | ||
| 17 | * 3. Neither the name of the University nor the names of its contributors | ||
| 18 | * may be used to endorse or promote products derived from this software | ||
| 19 | * without specific prior written permission. | ||
| 20 | * | ||
| 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
| 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
| 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 31 | * SUCH DAMAGE. | ||
| 32 | * | ||
| 33 | * from @(#)ipx_addr.c | ||
| 34 | */ | ||
| 35 | |||
| 36 | #include <sys/param.h> | ||
| 37 | #include <netipx/ipx.h> | ||
| 38 | #include <stdio.h> | ||
| 39 | #include <string.h> | ||
| 40 | |||
| 41 | static struct ipx_addr addr, zero_addr; | ||
| 42 | |||
| 43 | static void Field(char *, u_char *, int); | ||
| 44 | static void cvtbase(long, int, int *, int, unsigned char *, int); | ||
| 45 | |||
| 46 | struct ipx_addr | ||
| 47 | ipx_addr(const char *name) | ||
| 48 | { | ||
| 49 | char separator; | ||
| 50 | char *hostname, *socketname, *cp; | ||
| 51 | char buf[50]; | ||
| 52 | |||
| 53 | strlcpy(buf, name, sizeof(buf)); | ||
| 54 | |||
| 55 | /* | ||
| 56 | * First, figure out what he intends as a field separtor. | ||
| 57 | * Despite the way this routine is written, the prefered | ||
| 58 | * form 2-272.AA001234H.01777, i.e. XDE standard. | ||
| 59 | * Great efforts are made to insure backward compatibility. | ||
| 60 | */ | ||
| 61 | if ((hostname = strchr(buf, '#'))) | ||
| 62 | separator = '#'; | ||
| 63 | else { | ||
| 64 | hostname = strchr(buf, '.'); | ||
| 65 | if ((cp = strchr(buf, ':')) && | ||
| 66 | ((hostname && cp < hostname) || (hostname == 0))) { | ||
| 67 | hostname = cp; | ||
| 68 | separator = ':'; | ||
| 69 | } else | ||
| 70 | separator = '.'; | ||
| 71 | } | ||
| 72 | if (hostname) | ||
| 73 | *hostname++ = 0; | ||
| 74 | |||
| 75 | addr = zero_addr; | ||
| 76 | Field(buf, addr.ipx_net.c_net, 4); | ||
| 77 | if (hostname == 0) | ||
| 78 | return (addr); /* No separator means net only */ | ||
| 79 | |||
| 80 | socketname = strchr(hostname, separator); | ||
| 81 | if (socketname) { | ||
| 82 | *socketname++ = 0; | ||
| 83 | Field(socketname, (u_char *)&addr.ipx_port, 2); | ||
| 84 | } | ||
| 85 | |||
| 86 | Field(hostname, addr.ipx_host.c_host, 6); | ||
| 87 | |||
| 88 | return (addr); | ||
| 89 | } | ||
| 90 | |||
| 91 | static void | ||
| 92 | Field(char *buf, u_char *out, int len) | ||
| 93 | { | ||
| 94 | char *bp = buf; | ||
| 95 | int i, ibase, base16 = 0, base10 = 0, clen = 0; | ||
| 96 | int hb[6], *hp; | ||
| 97 | char *fmt; | ||
| 98 | |||
| 99 | /* | ||
| 100 | * first try 2-273#2-852-151-014#socket | ||
| 101 | */ | ||
| 102 | if ((*buf != '-') && | ||
| 103 | (1 < (i = sscanf(buf, "%d-%d-%d-%d-%d", | ||
| 104 | &hb[0], &hb[1], &hb[2], &hb[3], &hb[4])))) { | ||
| 105 | cvtbase(1000L, 256, hb, i, out, len); | ||
| 106 | return; | ||
| 107 | } | ||
| 108 | /* | ||
| 109 | * try form 8E1#0.0.AA.0.5E.E6#socket | ||
| 110 | */ | ||
| 111 | if (1 < (i = sscanf(buf,"%x.%x.%x.%x.%x.%x", | ||
| 112 | &hb[0], &hb[1], &hb[2], &hb[3], &hb[4], &hb[5]))) { | ||
| 113 | cvtbase(256L, 256, hb, i, out, len); | ||
| 114 | return; | ||
| 115 | } | ||
| 116 | /* | ||
| 117 | * try form 8E1#0:0:AA:0:5E:E6#socket | ||
| 118 | */ | ||
| 119 | if (1 < (i = sscanf(buf,"%x:%x:%x:%x:%x:%x", | ||
| 120 | &hb[0], &hb[1], &hb[2], &hb[3], &hb[4], &hb[5]))) { | ||
| 121 | cvtbase(256L, 256, hb, i, out, len); | ||
| 122 | return; | ||
| 123 | } | ||
| 124 | /* | ||
| 125 | * This is REALLY stretching it but there was a | ||
| 126 | * comma notation separting shorts -- definitely non standard | ||
| 127 | */ | ||
| 128 | if (1 < (i = sscanf(buf,"%x,%x,%x", | ||
| 129 | &hb[0], &hb[1], &hb[2]))) { | ||
| 130 | hb[0] = htons(hb[0]); hb[1] = htons(hb[1]); | ||
| 131 | hb[2] = htons(hb[2]); | ||
| 132 | cvtbase(65536L, 256, hb, i, out, len); | ||
| 133 | return; | ||
| 134 | } | ||
| 135 | |||
| 136 | /* Need to decide if base 10, 16 or 8 */ | ||
| 137 | while (*bp) switch (*bp++) { | ||
| 138 | |||
| 139 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
| 140 | case '6': case '7': case '-': | ||
| 141 | break; | ||
| 142 | |||
| 143 | case '8': case '9': | ||
| 144 | base10 = 1; | ||
| 145 | break; | ||
| 146 | |||
| 147 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
| 148 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
| 149 | base16 = 1; | ||
| 150 | break; | ||
| 151 | |||
| 152 | case 'x': case 'X': | ||
| 153 | *--bp = '0'; | ||
| 154 | base16 = 1; | ||
| 155 | break; | ||
| 156 | |||
| 157 | case 'h': case 'H': | ||
| 158 | base16 = 1; | ||
| 159 | /* fall into */ | ||
| 160 | |||
| 161 | default: | ||
| 162 | *--bp = 0; /* Ends Loop */ | ||
| 163 | } | ||
| 164 | if (base16) { | ||
| 165 | fmt = "%3x"; | ||
| 166 | ibase = 4096; | ||
| 167 | } else if (base10 == 0 && *buf == '0') { | ||
| 168 | fmt = "%3o"; | ||
| 169 | ibase = 512; | ||
| 170 | } else { | ||
| 171 | fmt = "%3d"; | ||
| 172 | ibase = 1000; | ||
| 173 | } | ||
| 174 | |||
| 175 | for (bp = buf; *bp++; ) clen++; | ||
| 176 | if (clen == 0) clen++; | ||
| 177 | if (clen > 18) clen = 18; | ||
| 178 | i = ((clen - 1) / 3) + 1; | ||
| 179 | bp = clen + buf - 3; | ||
| 180 | hp = hb + i - 1; | ||
| 181 | |||
| 182 | while (hp > hb) { | ||
| 183 | (void)sscanf(bp, fmt, hp); | ||
| 184 | bp[0] = 0; | ||
| 185 | hp--; | ||
| 186 | bp -= 3; | ||
| 187 | } | ||
| 188 | (void)sscanf(buf, fmt, hp); | ||
| 189 | cvtbase((long)ibase, 256, hb, i, out, len); | ||
| 190 | } | ||
| 191 | |||
| 192 | static void | ||
| 193 | cvtbase(long oldbase, int newbase, int *input, int inlen, | ||
| 194 | unsigned char *result, int reslen) | ||
| 195 | { | ||
| 196 | int d, e; | ||
| 197 | long sum; | ||
| 198 | |||
| 199 | e = 1; | ||
| 200 | while (e > 0 && reslen > 0) { | ||
| 201 | d = 0; e = 0; sum = 0; | ||
| 202 | /* long division: input=input/newbase */ | ||
| 203 | while (d < inlen) { | ||
| 204 | sum = sum*oldbase + (long) input[d]; | ||
| 205 | e += (sum > 0); | ||
| 206 | input[d++] = sum / newbase; | ||
| 207 | sum %= newbase; | ||
| 208 | } | ||
| 209 | result[--reslen] = sum; /* accumulate remainder */ | ||
| 210 | } | ||
| 211 | for (d=0; d < reslen; d++) | ||
| 212 | result[d] = 0; | ||
| 213 | } | ||
diff --git a/src/lib/libc/net/ipx_ntoa.c b/src/lib/libc/net/ipx_ntoa.c deleted file mode 100644 index 9b1b6a1c49..0000000000 --- a/src/lib/libc/net/ipx_ntoa.c +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | /* $OpenBSD: ipx_ntoa.c,v 1.6 2005/08/06 20:30:03 espie Exp $ */ | ||
| 2 | /* | ||
| 3 | * Copyright (c) 1986, 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 | |||
| 31 | #include <sys/param.h> | ||
| 32 | #include <netipx/ipx.h> | ||
| 33 | #include <stdio.h> | ||
| 34 | |||
| 35 | char * | ||
| 36 | ipx_ntoa(struct ipx_addr addr) | ||
| 37 | { | ||
| 38 | static char obuf[] = "xxxxxxxxH.xx:xx:xx:xx:xx:xx.uuuuu"; | ||
| 39 | |||
| 40 | snprintf(obuf, sizeof obuf, "%8xH.%02x:%02x:%02x:%02x:%02x:%02x.%u", | ||
| 41 | ntohl(addr.ipx_net.l_net), addr.ipx_host.c_host[0], | ||
| 42 | addr.ipx_host.c_host[1], addr.ipx_host.c_host[2], | ||
| 43 | addr.ipx_host.c_host[3], addr.ipx_host.c_host[4], | ||
| 44 | addr.ipx_host.c_host[5], ntohs(addr.ipx_port)); | ||
| 45 | return (obuf); | ||
| 46 | } | ||
