diff options
Diffstat (limited to 'contrib/bind/bin/addr')
-rw-r--r-- | contrib/bind/bin/addr/Makefile | 85 | ||||
-rw-r--r-- | contrib/bind/bin/addr/addr.c | 177 |
2 files changed, 0 insertions, 262 deletions
diff --git a/contrib/bind/bin/addr/Makefile b/contrib/bind/bin/addr/Makefile deleted file mode 100644 index 98b7a9197b537..0000000000000 --- a/contrib/bind/bin/addr/Makefile +++ /dev/null @@ -1,85 +0,0 @@ -## Copyright (c) 1996,1999 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. - -# $Id: Makefile,v 8.26 2000/07/11 06:41:27 vixie Exp $ - -DESTDIR= -CC= cc -SHELL= /bin/sh - -CDEBUG= -g - -#(net2 and its descendents) -SYSTYPE = bsdos -TOP = ../.. -INCL = ${TOP}/include -PORTINCL = ${TOP}/port/${SYSTYPE}/include -LIBBIND = ${TOP}/lib/libbind.a -A=a -O=o -EXE= -LEX = lex -I -SYSLIBS = -ll -lutil -DESTBIN = /usr/local/bin -DESTSBIN = /usr/local/sbin -DESTEXEC = /usr/local/libexec -DESTMAN = /usr/share/man -DESTHELP= /usr/share/misc -STRIP=-s -INSTALL_EXEC= -INSTALL_LIB=-o bin -g bin - -LDFLAGS= -CFLAGS= ${CDEBUG} -CPPFLAGS= -I${PORTINCL} -I${INCL} - -PROG= addr -SRCS= ${PROG}.c -OBJS= ${PROG}.${O} - -all: ${PROG}${EXE} - -${PROG}${EXE}: ${OBJS} ${LIBBIND} Makefile - ${CC} ${CDEBUG} ${LDFLAGS} ${BOUNDS} -o ${PROG}${EXE} ${OBJS} \ - ${LIBBIND} ${SYSLIBS} - -.c.${O}: - ${CC} ${CPPFLAGS} ${CFLAGS} ${BOUNDS} -c $*.c - -distclean: clean - -clean: FRC - rm -f ${PROG}${EXE} ${OBJS} core .depend - rm -f *.BAK *.CKP *~ *.orig - -depend: ${SRCS} - mkdep ${CPPFLAGS} -I${INCL} -I${PORTINCL} ${SRCS} - -${DESTDIR}${DESTBIN}: - mkdir -p ${DESTDIR}${DESTBIN} - -install: ${DESTDIR}${DESTBIN} ${PROG}${EXE} - ${INSTALL} ${STRIP} -c ${INSTALL_EXEC} -m 755 ${PROG}${EXE} ${DESTDIR}${DESTBIN}/${PROG}${EXE} - -links: FRC - @set -e; ln -s SRC/*.[ch] . - -tags: FRC - ctags *.[ch] - -FRC: - -# DO NOT DELETE THIS LINE -- mkdep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. diff --git a/contrib/bind/bin/addr/addr.c b/contrib/bind/bin/addr/addr.c deleted file mode 100644 index a6933918c8675..0000000000000 --- a/contrib/bind/bin/addr/addr.c +++ /dev/null @@ -1,177 +0,0 @@ -#if !defined(lint) && !defined(SABER) -static const char rcsid[] = "$Id: addr.c,v 8.8 1999/10/13 16:38:55 vixie Exp $"; -#endif /* not lint */ - -/* - * Copyright (c) 1996,1999 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 "port_before.h" -#include <sys/param.h> -#include <sys/file.h> -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/nameser.h> -#include <arpa/inet.h> -#include <ctype.h> -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include "port_after.h" - -static const char *prog = "addr"; - -#define BIGGEST_ADDRESS IN6ADDRSZ - -static void -usage() { - fprintf(stderr, - "usage: %s [-4] [-6] [-n hexstring] [-p address]\n", - prog); - exit(1); -} - -/* Warning: this scribbles on `dst' even if it's going to return `0'. */ -static int -hexstring(src, dst, len) - const char *src; - u_char *dst; - int len; -{ - static const char xdigits[] = "0123456789abcdef"; - u_char *ptr = dst, *end = dst + len; - u_int val; - int ch, digits; - - val = 0; - digits = 0; - memset(dst, 0, len); - while ((ch = *src++) != '\0') { - if (ch == '0' && (*src == 'x' || *src == 'X')) { - src++; - continue; - } - if (isascii(ch) && (isspace(ch) || ispunct(ch))) { - if (digits > 0) { - if (ptr == end) - return (0); - *ptr++ = (u_char) (val & 0xff); - val = 0; - digits = 0; - } - digits = 0; - continue; - } - if (!isascii(ch) || !isxdigit(ch)) - return (0); - if (isupper(ch)) - ch = tolower(ch); - /* Clock it in using little endian arithmetic. */ - val <<= 4; - val |= (strchr(xdigits, ch) - xdigits); - if (++digits == 2) { - if (ptr == end) - return (0); - *ptr++ = (u_char) (val & 0xff); - digits = 0; - val = 0; - } - } - if (digits > 0) { - if (ptr == end) - return (0); - *ptr++ = (u_char) (val & 0xff); - } - return ((ptr - dst) == len); -} - -static void -display(input, af, addr, len) - const char *input; - int af; - const u_char *addr; - int len; -{ - static int before = 0; - char p[sizeof "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255"]; - int i; - - if (before) - putchar('\n'); - else - before++; - - printf("Input: \"%s\"\n", input); - printf("Network: [af%d len%d]", af, len); - for (i = 0; i < len; i++) - printf(" %02x", addr[i]); - putchar('\n'); - printf("Presentation: \"%s\"\n", inet_ntop(af, addr, p, sizeof p)); -} - -int -main(argc, argv) - int argc; - char *argv[]; -{ - u_char addr[BIGGEST_ADDRESS]; - int optchr, af, len, some; - - prog = argv[0]; - af = AF_INET; - len = INADDRSZ; - some = 0; - while ((optchr = getopt(argc, argv, "46n:p:")) != -1) { - switch (optchr) { - case '4': - af = AF_INET; - len = INADDRSZ; - break; - case '6': - af = AF_INET6; - len = IN6ADDRSZ; - break; - case 'n': - if (!hexstring(optarg, addr, len)) { - fprintf(stderr, "bad hex string: \"%s\"\n", - optarg); - usage(); - /* NOTREACHED */ - } - display(optarg, af, addr, len); - some++; - break; - case 'p': - if (inet_pton(af, optarg, addr) <= 0) { - fprintf(stderr, "bad address: \"%s\"\n", - optarg); - usage(); - /* NOTREACHED */ - } - display(optarg, af, addr, len); - some++; - break; - default: - usage(); - /* NOTREACHED */ - } - } - if (!some) - usage(); - exit(0); - /* NOTREACHED */ -} |