diff options
author | deraadt <> | 2013-12-17 16:34:05 +0000 |
---|---|---|
committer | deraadt <> | 2013-12-17 16:34:05 +0000 |
commit | d8a859e047747940bda25e0117035deac310f330 (patch) | |
tree | b7f15e081e0d1355ca5dd56edb548a514ca7a562 /src/lib/libc/net/nsap_addr.c | |
parent | c7fda965b6d5f900572cfc2fb6cca301173bd389 (diff) | |
download | openbsd-d8a859e047747940bda25e0117035deac310f330.tar.gz openbsd-d8a859e047747940bda25e0117035deac310f330.tar.bz2 openbsd-d8a859e047747940bda25e0117035deac310f330.zip |
inet_nsap_ntoa() and inet_nsap_addr() go away. Unused APIs from darker
days.
Diffstat (limited to 'src/lib/libc/net/nsap_addr.c')
-rw-r--r-- | src/lib/libc/net/nsap_addr.c | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/src/lib/libc/net/nsap_addr.c b/src/lib/libc/net/nsap_addr.c deleted file mode 100644 index 8cfe86f475..0000000000 --- a/src/lib/libc/net/nsap_addr.c +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* $OpenBSD: nsap_addr.c,v 1.7 2006/03/31 05:35:44 deraadt Exp $ */ | ||
2 | |||
3 | /* | ||
4 | * Copyright (c) 1996 by Internet Software Consortium. | ||
5 | * | ||
6 | * Permission to use, copy, modify, and distribute this software for any | ||
7 | * purpose with or without fee is hereby granted, provided that the above | ||
8 | * copyright notice and this permission notice appear in all copies. | ||
9 | * | ||
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS | ||
11 | * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES | ||
12 | * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE | ||
13 | * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL | ||
14 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR | ||
15 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS | ||
16 | * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | ||
17 | * SOFTWARE. | ||
18 | */ | ||
19 | |||
20 | #include <sys/types.h> | ||
21 | #include <sys/param.h> | ||
22 | #include <sys/socket.h> | ||
23 | #include <netinet/in.h> | ||
24 | #include <arpa/nameser.h> | ||
25 | #include <ctype.h> | ||
26 | #include <resolv.h> | ||
27 | |||
28 | static u_char | ||
29 | xtob(int c) | ||
30 | { | ||
31 | return (c - (((c >= '0') && (c <= '9')) ? '0' : '7')); | ||
32 | } | ||
33 | |||
34 | u_int | ||
35 | inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) | ||
36 | { | ||
37 | u_char c, nib; | ||
38 | u_int len = 0; | ||
39 | |||
40 | while ((c = *ascii++) != '\0' && len < maxlen) { | ||
41 | if (c == '.' || c == '+' || c == '/') | ||
42 | continue; | ||
43 | if (!isascii(c)) | ||
44 | return (0); | ||
45 | if (islower(c)) | ||
46 | c = (u_char)toupper(c); | ||
47 | if (isxdigit(c)) { | ||
48 | nib = xtob(c); | ||
49 | if ((c = *ascii++)) { | ||
50 | c = (u_char)toupper(c); | ||
51 | if (isxdigit(c)) { | ||
52 | *binary++ = (nib << 4) | xtob(c); | ||
53 | len++; | ||
54 | } else | ||
55 | return (0); | ||
56 | } | ||
57 | else | ||
58 | return (0); | ||
59 | } | ||
60 | else | ||
61 | return (0); | ||
62 | } | ||
63 | return (len); | ||
64 | } | ||
65 | |||
66 | char * | ||
67 | inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) | ||
68 | { | ||
69 | int nib; | ||
70 | int i; | ||
71 | static char tmpbuf[255*3]; | ||
72 | char *start; | ||
73 | |||
74 | if (ascii) | ||
75 | start = ascii; | ||
76 | else { | ||
77 | ascii = tmpbuf; | ||
78 | start = tmpbuf; | ||
79 | } | ||
80 | |||
81 | if (binlen > 255) | ||
82 | binlen = 255; | ||
83 | |||
84 | for (i = 0; i < binlen; i++) { | ||
85 | nib = *binary >> 4; | ||
86 | *ascii++ = nib + (nib < 10 ? '0' : '7'); | ||
87 | nib = *binary++ & 0x0f; | ||
88 | *ascii++ = nib + (nib < 10 ? '0' : '7'); | ||
89 | if (((i % 2) == 0 && (i + 1) < binlen)) | ||
90 | *ascii++ = '.'; | ||
91 | } | ||
92 | *ascii = '\0'; | ||
93 | return (start); | ||
94 | } | ||