From 1546342f025129a0626f3a204905113e08b60073 Mon Sep 17 00:00:00 2001 From: Paul Traina Date: Thu, 22 Sep 1994 21:50:41 +0000 Subject: [PATCH] Port nslookup to FreeBSD --- usr.sbin/nslookup/Makefile | 14 ++++++++++++++ usr.sbin/nslookup/debug.c | 11 ++++++++--- usr.sbin/nslookup/getinfo.c | 3 +-- usr.sbin/nslookup/list.c | 12 +++++++++--- usr.sbin/nslookup/main.c | 8 ++++---- usr.sbin/nslookup/pathnames.h | 5 ----- usr.sbin/nslookup/send.c | 3 +-- usr.sbin/nslookup/skip.c | 3 +-- usr.sbin/nslookup/subr.c | 10 +++++----- 9 files changed, 43 insertions(+), 26 deletions(-) create mode 100644 usr.sbin/nslookup/Makefile diff --git a/usr.sbin/nslookup/Makefile b/usr.sbin/nslookup/Makefile new file mode 100644 index 000000000000..4295c990aa8c --- /dev/null +++ b/usr.sbin/nslookup/Makefile @@ -0,0 +1,14 @@ +# @(#)Makefile 8.1 (Berkeley) 6/6/93 + +PROG= nslookup +SRCS= main.c commands.l getinfo.c debug.c send.c skip.c list.c subr.c +MAN8= nslookup.8 +DPADD+= ${LIBL} +LDADD+= -ll +CLEANFILES+=lex.yy.o + +beforeinstall: + install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/nslookup.help \ + ${DESTDIR}/usr/share/misc + +.include diff --git a/usr.sbin/nslookup/debug.c b/usr.sbin/nslookup/debug.c index d8af2fcbeb1d..1d5383e60050 100644 --- a/usr.sbin/nslookup/debug.c +++ b/usr.sbin/nslookup/debug.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)debug.c 5.26 (Berkeley) 3/21/91"; -static char rcsid[] = "$Id: debug.c,v 4.9.1.9 1994/06/06 09:08:43 vixie Exp $"; +static char rcsid[] = "$Id: debug.c,v 1.1.1.1 1994/09/22 21:36:01 pst Exp $"; #endif /* not lint */ /* @@ -72,13 +72,13 @@ static char rcsid[] = "$Id: debug.c,v 4.9.1.9 1994/06/06 09:08:43 vixie Exp $"; #include #include +#include #include #include #include #include #include #include "res.h" -#include "../../conf/portability.h" /* * Imported from res_debug.c @@ -256,6 +256,7 @@ Print_rr(cp, msg, eom, file) int type, class, dlen, n, c; u_int32_t rrttl, ttl; struct in_addr inaddr; + struct iso_addr isoa; u_char *cp1, *cp2; int debug; @@ -453,7 +454,11 @@ doname: break; case T_NSAP: - fprintf(file, "\tnsap = %s\n", inet_nsap_ntoa(dlen, cp, NULL)); + isoa.isoa_len = dlen; + if (isoa.isoa_len > sizeof(isoa.isoa_genaddr)) + isoa.isoa_len = sizeof(isoa.isoa_genaddr); + bcopy(cp, isoa.isoa_genaddr, isoa.isoa_len); + fprintf(file, "\tnsap = %s\n", iso_ntoa(&isoa)); cp += dlen; break; diff --git a/usr.sbin/nslookup/getinfo.c b/usr.sbin/nslookup/getinfo.c index 610d57adf96c..7d86c2c78b1e 100644 --- a/usr.sbin/nslookup/getinfo.c +++ b/usr.sbin/nslookup/getinfo.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)getinfo.c 5.26 (Berkeley) 3/21/91"; -static char rcsid[] = "$Id: getinfo.c,v 4.9.1.6 1994/06/01 21:10:16 vixie Exp $"; +static char rcsid[] = "$Id: getinfo.c,v 1.1.1.1 1994/09/22 21:36:01 pst Exp $"; #endif /* not lint */ /* @@ -80,7 +80,6 @@ static char rcsid[] = "$Id: getinfo.c,v 4.9.1.6 1994/06/01 21:10:16 vixie Exp $" #include #include #include "res.h" -#include "../../conf/portability.h" extern char *_res_resultcodes[]; extern char *res_skip(); diff --git a/usr.sbin/nslookup/list.c b/usr.sbin/nslookup/list.c index e78d143bfa1f..6bafe1969054 100644 --- a/usr.sbin/nslookup/list.c +++ b/usr.sbin/nslookup/list.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)list.c 5.23 (Berkeley) 3/21/91"; -static char rcsid[] = "$Id: list.c,v 4.9.1.11 1994/06/06 09:08:43 vixie Exp $"; +static char rcsid[] = "$Id: list.c,v 1.1.1.1 1994/09/22 21:36:01 pst Exp $"; #endif /* not lint */ /* @@ -73,6 +73,7 @@ static char rcsid[] = "$Id: list.c,v 4.9.1.11 1994/06/06 09:08:43 vixie Exp $"; #include #include #include +#include #include #include #include @@ -81,8 +82,8 @@ static char rcsid[] = "$Id: list.c,v 4.9.1.11 1994/06/06 09:08:43 vixie Exp $"; #include #include #include +#include #include "res.h" -#include "../../conf/portability.h" extern char *_res_resultcodes[]; /* res_debug.c */ extern char *pager; @@ -586,6 +587,7 @@ PrintListInfo(file, msg, eom, qtype, domain) u_int32_t ttl; int n, pref; struct in_addr inaddr; + struct iso_addr isoa; char name[NAME_LEN]; char name2[NAME_LEN]; Boolean stripped; @@ -768,7 +770,11 @@ PrintListInfo(file, msg, eom, qtype, domain) break; case T_NSAP: - fprintf(file, " %s", inet_nsap_ntoa(dlen, cp, NULL)); + isoa.isoa_len = dlen; + if (isoa.isoa_len > sizeof(isoa.isoa_genaddr)) + isoa.isoa_len = sizeof(isoa.isoa_genaddr); + bcopy(cp, isoa.isoa_genaddr, isoa.isoa_len); + fprintf(file, " %s", iso_ntoa(&isoa)); break; case T_MINFO: diff --git a/usr.sbin/nslookup/main.c b/usr.sbin/nslookup/main.c index 2324ed8b4be0..5daeadf8d0ec 100644 --- a/usr.sbin/nslookup/main.c +++ b/usr.sbin/nslookup/main.c @@ -61,7 +61,7 @@ char copyright[] = #ifndef lint static char sccsid[] = "@(#)main.c 5.42 (Berkeley) 3/3/91"; -static char rcsid[] = "$Id: main.c,v 4.9.1.3 1993/09/16 09:02:07 vixie Exp $"; +static char rcsid[] = "$Id: main.c,v 1.1.1.1 1994/09/22 21:36:01 pst Exp $"; #endif /* not lint */ /* @@ -92,10 +92,10 @@ static char rcsid[] = "$Id: main.c,v 4.9.1.3 1993/09/16 09:02:07 vixie Exp $"; #include #include #include +#include +#include #include "res.h" #include "pathnames.h" -#include "../../conf/portability.h" - /* * Name of a top-level name server. Can be changed with @@ -143,7 +143,7 @@ int queryClass = C_IN; * Stuff for Interrupt (control-C) signal handler. */ -extern SIG_FN IntrHandler(); +extern void IntrHandler(); FILE *filePtr; jmp_buf env; diff --git a/usr.sbin/nslookup/pathnames.h b/usr.sbin/nslookup/pathnames.h index a91529322eca..f2693b5420ce 100644 --- a/usr.sbin/nslookup/pathnames.h +++ b/usr.sbin/nslookup/pathnames.h @@ -62,10 +62,5 @@ #define _PATH_PAGERCMD "more" #ifndef _PATH_HELPFILE -#if defined(BSD) && BSD >= 198810 #define _PATH_HELPFILE "/usr/share/misc/nslookup.help" -#else -#define _PATH_HELPFILE "/usr/lib/nslookup.help" #endif -#endif - diff --git a/usr.sbin/nslookup/send.c b/usr.sbin/nslookup/send.c index e895bfae5add..6e793a5aebdd 100644 --- a/usr.sbin/nslookup/send.c +++ b/usr.sbin/nslookup/send.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)send.c 5.18 (Berkeley) 3/2/91"; -static char rcsid[] = "$Id: send.c,v 4.9.1.5 1994/06/06 09:08:43 vixie Exp $"; +static char rcsid[] = "$Id: send.c,v 1.1.1.1 1994/09/22 21:36:02 pst Exp $"; #endif /* not lint */ /* @@ -86,7 +86,6 @@ static char rcsid[] = "$Id: send.c,v 4.9.1.5 1994/06/06 09:08:43 vixie Exp $"; #include #include #include "res.h" -#include "../../conf/portability.h" static int s = -1; /* socket used for communications */ diff --git a/usr.sbin/nslookup/skip.c b/usr.sbin/nslookup/skip.c index 4119951962a2..7b5f889a0e52 100644 --- a/usr.sbin/nslookup/skip.c +++ b/usr.sbin/nslookup/skip.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)skip.c 5.12 (Berkeley) 3/21/91"; -static char rcsid[] = "$Id: skip.c,v 4.9.1.6 1994/06/01 21:10:16 vixie Exp $"; +static char rcsid[] = "$Id: skip.c,v 1.1.1.1 1994/09/22 21:36:02 pst Exp $"; #endif /* not lint */ /* @@ -80,7 +80,6 @@ static char rcsid[] = "$Id: skip.c,v 4.9.1.6 1994/06/01 21:10:16 vixie Exp $"; #include #include #include -#include "../../conf/portability.h" char *res_skip_rr(); diff --git a/usr.sbin/nslookup/subr.c b/usr.sbin/nslookup/subr.c index f9d901292b40..0ad71f76fb39 100644 --- a/usr.sbin/nslookup/subr.c +++ b/usr.sbin/nslookup/subr.c @@ -55,7 +55,7 @@ #ifndef lint static char sccsid[] = "@(#)subr.c 5.24 (Berkeley) 3/2/91"; -static char rcsid[] = "$Id: subr.c,v 4.9.1.7 1994/07/19 22:51:24 vixie Exp $"; +static char rcsid[] = "$Id: subr.c,v 1.1.1.1 1994/09/22 21:36:02 pst Exp $"; #endif /* not lint */ /* @@ -84,9 +84,9 @@ static char rcsid[] = "$Id: subr.c,v 4.9.1.7 1994/07/19 22:51:24 vixie Exp $"; #include #include #include +#include +#include #include "res.h" -#include "../../conf/portability.h" - /* @@ -113,7 +113,7 @@ static char rcsid[] = "$Id: subr.c,v 4.9.1.7 1994/07/19 22:51:24 vixie Exp $"; ******************************************************************************* */ -SIG_FN +void IntrHandler() { extern jmp_buf env; @@ -170,7 +170,7 @@ Malloc(size) ptr = malloc((unsigned) size); sigrelse(SIGINT); #else - { SIG_FN (*old)(); + { void (*old)(); old = signal(SIGINT, SIG_IGN); ptr = malloc((unsigned) size); signal(SIGINT, old);