diff options
author | 2013-12-17 16:34:05 +0000 | |
---|---|---|
committer | 2013-12-17 16:34:05 +0000 | |
commit | 84d967b079ee896f32088df0f64876a3612f72da (patch) | |
tree | f8f4ee82b843e9799829193ad76b514d9b25100a /lib/libc | |
parent | f_prealloc() goes away. Comment from the original source file: (diff) | |
download | wireguard-openbsd-84d967b079ee896f32088df0f64876a3612f72da.tar.xz wireguard-openbsd-84d967b079ee896f32088df0f64876a3612f72da.zip |
inet_nsap_ntoa() and inet_nsap_addr() go away. Unused APIs from darker
days.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/net/Makefile.inc | 10 | ||||
-rw-r--r-- | lib/libc/net/nsap_addr.c | 94 |
2 files changed, 4 insertions, 100 deletions
diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc index 48279d2423d..580df4444ab 100644 --- a/lib/libc/net/Makefile.inc +++ b/lib/libc/net/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.49 2012/01/17 02:33:20 deraadt Exp $ +# $OpenBSD: Makefile.inc,v 1.50 2013/12/17 16:34:05 deraadt Exp $ # net sources .PATH: ${LIBCSRCDIR}/arch/${MACHINE_CPU}/net ${LIBCSRCDIR}/net @@ -12,11 +12,9 @@ SRCS+= base64.c freeaddrinfo.c gai_strerror.c getaddrinfo.c gethostnamadr.c \ herror.c if_indextoname.c if_nameindex.c if_nametoindex.c inet_addr.c \ inet_lnaof.c inet_makeaddr.c inet_neta.c inet_netof.c inet_network.c \ inet_net_ntop.c inet_net_pton.c inet_ntoa.c inet_ntop.c inet_pton.c \ - linkaddr.c nsap_addr.c \ - rcmd.c ruserok.c rresvport.c recv.c res_comp.c res_data.c res_debug.c \ - res_debug_syms.c \ - res_init.c res_mkquery.c res_query.c res_random.c res_send.c send.c \ - sethostent.c ethers.c rcmdsh.c + linkaddr.c rcmd.c ruserok.c rresvport.c recv.c res_comp.c res_data.c \ + res_debug.c res_debug_syms.c res_init.c res_mkquery.c res_query.c \ + res_random.c res_send.c send.c sethostent.c ethers.c rcmdsh.c # IPv6 SRCS+= ip6opt.c rthdr.c vars6.c diff --git a/lib/libc/net/nsap_addr.c b/lib/libc/net/nsap_addr.c deleted file mode 100644 index 8cfe86f4752..00000000000 --- a/lib/libc/net/nsap_addr.c +++ /dev/null @@ -1,94 +0,0 @@ -/* $OpenBSD: nsap_addr.c,v 1.7 2006/03/31 05:35:44 deraadt Exp $ */ - -/* - * Copyright (c) 1996 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS - * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE - * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/nameser.h> -#include <ctype.h> -#include <resolv.h> - -static u_char -xtob(int c) -{ - return (c - (((c >= '0') && (c <= '9')) ? '0' : '7')); -} - -u_int -inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) -{ - u_char c, nib; - u_int len = 0; - - while ((c = *ascii++) != '\0' && len < maxlen) { - if (c == '.' || c == '+' || c == '/') - continue; - if (!isascii(c)) - return (0); - if (islower(c)) - c = (u_char)toupper(c); - if (isxdigit(c)) { - nib = xtob(c); - if ((c = *ascii++)) { - c = (u_char)toupper(c); - if (isxdigit(c)) { - *binary++ = (nib << 4) | xtob(c); - len++; - } else - return (0); - } - else - return (0); - } - else - return (0); - } - return (len); -} - -char * -inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) -{ - int nib; - int i; - static char tmpbuf[255*3]; - char *start; - - if (ascii) - start = ascii; - else { - ascii = tmpbuf; - start = tmpbuf; - } - - if (binlen > 255) - binlen = 255; - - for (i = 0; i < binlen; i++) { - nib = *binary >> 4; - *ascii++ = nib + (nib < 10 ? '0' : '7'); - nib = *binary++ & 0x0f; - *ascii++ = nib + (nib < 10 ? '0' : '7'); - if (((i % 2) == 0 && (i + 1) < binlen)) - *ascii++ = '.'; - } - *ascii = '\0'; - return (start); -} |