diff options
author | millert <> | 2004-07-13 21:06:58 +0000 |
---|---|---|
committer | millert <> | 2004-07-13 21:06:58 +0000 |
commit | b30926eb26089ec41bda98ce642ae145915f9a26 (patch) | |
tree | d423ee16a9f7aca1505824f4c0176d858fbe91e3 /src/lib/libc/net/iso_addr.c | |
parent | a9a5272957f8121d84dc118a506ba3bac7e02bbd (diff) | |
download | openbsd-b30926eb26089ec41bda98ce642ae145915f9a26.tar.gz openbsd-b30926eb26089ec41bda98ce642ae145915f9a26.tar.bz2 openbsd-b30926eb26089ec41bda98ce642ae145915f9a26.zip |
Remove iso_addr() and iso_ntoa() as part of the netiso removal.
From henning@, OK deraadt@
Diffstat (limited to 'src/lib/libc/net/iso_addr.c')
-rw-r--r-- | src/lib/libc/net/iso_addr.c | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/src/lib/libc/net/iso_addr.c b/src/lib/libc/net/iso_addr.c deleted file mode 100644 index f0f8444325..0000000000 --- a/src/lib/libc/net/iso_addr.c +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 1989, 1993 | ||
3 | * The Regents of the University of California. All rights reserved. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions | ||
7 | * are met: | ||
8 | * 1. Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * 2. Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * 3. Neither the name of the University nor the names of its contributors | ||
14 | * may be used to endorse or promote products derived from this software | ||
15 | * without specific prior written permission. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
27 | * SUCH DAMAGE. | ||
28 | */ | ||
29 | |||
30 | #if defined(LIBC_SCCS) && !defined(lint) | ||
31 | static char rcsid[] = "$OpenBSD: iso_addr.c,v 1.3 2003/06/02 20:18:35 millert Exp $"; | ||
32 | #endif /* LIBC_SCCS and not lint */ | ||
33 | |||
34 | #include <sys/types.h> | ||
35 | #include <netiso/iso.h> | ||
36 | #include <string.h> | ||
37 | |||
38 | /* States*/ | ||
39 | #define VIRGIN 0 | ||
40 | #define GOTONE 1 | ||
41 | #define GOTTWO 2 | ||
42 | /* Inputs */ | ||
43 | #define DIGIT (4*0) | ||
44 | #define END (4*1) | ||
45 | #define DELIM (4*2) | ||
46 | |||
47 | struct iso_addr * | ||
48 | iso_addr(addr) | ||
49 | register const char *addr; | ||
50 | { | ||
51 | static struct iso_addr out_addr; | ||
52 | register char *cp = out_addr.isoa_genaddr; | ||
53 | char *cplim = cp + sizeof(out_addr.isoa_genaddr); | ||
54 | register int byte = 0, state = VIRGIN, new; | ||
55 | |||
56 | bzero((char *)&out_addr, sizeof(out_addr)); | ||
57 | do { | ||
58 | if ((*addr >= '0') && (*addr <= '9')) { | ||
59 | new = *addr - '0'; | ||
60 | } else if ((*addr >= 'a') && (*addr <= 'f')) { | ||
61 | new = *addr - 'a' + 10; | ||
62 | } else if ((*addr >= 'A') && (*addr <= 'F')) { | ||
63 | new = *addr - 'A' + 10; | ||
64 | } else if (*addr == 0) | ||
65 | state |= END; | ||
66 | else | ||
67 | state |= DELIM; | ||
68 | addr++; | ||
69 | switch (state /* | INPUT */) { | ||
70 | case GOTTWO | DIGIT: | ||
71 | *cp++ = byte; /*FALLTHROUGH*/ | ||
72 | case VIRGIN | DIGIT: | ||
73 | state = GOTONE; byte = new; continue; | ||
74 | case GOTONE | DIGIT: | ||
75 | state = GOTTWO; byte = new + (byte << 4); continue; | ||
76 | default: /* | DELIM */ | ||
77 | state = VIRGIN; *cp++ = byte; byte = 0; continue; | ||
78 | case GOTONE | END: | ||
79 | case GOTTWO | END: | ||
80 | *cp++ = byte; /* FALLTHROUGH */ | ||
81 | case VIRGIN | END: | ||
82 | break; | ||
83 | } | ||
84 | break; | ||
85 | } while (cp < cplim); | ||
86 | out_addr.isoa_len = cp - out_addr.isoa_genaddr; | ||
87 | return (&out_addr); | ||
88 | } | ||
89 | static char hexlist[] = "0123456789abcdef"; | ||
90 | |||
91 | char * | ||
92 | iso_ntoa(isoa) | ||
93 | const struct iso_addr *isoa; | ||
94 | { | ||
95 | static char obuf[64]; | ||
96 | register char *out = obuf; | ||
97 | register int i; | ||
98 | register u_char *in = (u_char *)isoa->isoa_genaddr; | ||
99 | u_char *inlim = in + isoa->isoa_len; | ||
100 | |||
101 | out[1] = 0; | ||
102 | while (in < inlim) { | ||
103 | i = *in++; | ||
104 | *out++ = '.'; | ||
105 | if (i > 0xf) { | ||
106 | out[1] = hexlist[i & 0xf]; | ||
107 | i >>= 4; | ||
108 | out[0] = hexlist[i]; | ||
109 | out += 2; | ||
110 | } else | ||
111 | *out++ = hexlist[i]; | ||
112 | } | ||
113 | *out = 0; | ||
114 | return(obuf + 1); | ||
115 | } | ||