Port nslookup to FreeBSD

This commit is contained in:
Paul Traina 1994-09-22 21:50:41 +00:00
parent 835ce5a154
commit 1546342f02
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2993
9 changed files with 43 additions and 26 deletions

View File

@ -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 <bsd.prog.mk>

View File

@ -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 <sys/param.h>
#include <netinet/in.h>
#include <netiso/iso.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <resolv.h>
#include <netdb.h>
#include <stdio.h>
#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;

View File

@ -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 <stdio.h>
#include <ctype.h>
#include "res.h"
#include "../../conf/portability.h"
extern char *_res_resultcodes[];
extern char *res_skip();

View File

@ -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 <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netiso/iso.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
#include <resolv.h>
@ -81,8 +82,8 @@ static char rcsid[] = "$Id: list.c,v 4.9.1.11 1994/06/06 09:08:43 vixie Exp $";
#include <limits.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
#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:

View File

@ -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 <stdio.h>
#include <errno.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#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;

View File

@ -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

View File

@ -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 <arpa/inet.h>
#include <resolv.h>
#include "res.h"
#include "../../conf/portability.h"
static int s = -1; /* socket used for communications */

View File

@ -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 <arpa/nameser.h>
#include <resolv.h>
#include <stdio.h>
#include "../../conf/portability.h"
char *res_skip_rr();

View File

@ -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 <signal.h>
#include <setjmp.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#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);