diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/Makefile.inc | 4 | ||||
-rw-r--r-- | lib/libc/net/gethostbydns.c | 8 | ||||
-rw-r--r-- | lib/libc/net/getnetbydns.c | 6 | ||||
-rw-r--r-- | lib/libc/net/res_init.c | 10 | ||||
-rw-r--r-- | lib/libc/net/res_mkquery.c | 4 | ||||
-rw-r--r-- | lib/libc/net/res_query.c | 12 | ||||
-rw-r--r-- | lib/libc/net/res_send.c | 71 |
7 files changed, 38 insertions, 77 deletions
diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc index d0b0673..6070530 100644 --- a/lib/libc/net/Makefile.inc +++ b/lib/libc/net/Makefile.inc @@ -12,10 +12,6 @@ SRCS+= gethostbydns.c gethostbyht.c gethostbynis.c gethostnamadr.c \ res_debug.c res_init.c res_mkquery.c res_query.c res_send.c \ send.c -# dig(1) requires the resolver to be compiled with debugging enabled -# if you don't care abut dig, you may comment this out -CFLAGS+=-DDEBUG - # machine-dependent net sources .include "${.CURDIR}/${MACHINE}/net/Makefile.inc" diff --git a/lib/libc/net/gethostbydns.c b/lib/libc/net/gethostbydns.c index 24a8733..baeceee 100644 --- a/lib/libc/net/gethostbydns.c +++ b/lib/libc/net/gethostbydns.c @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: gethnamaddr.c,v 4.9.1.19 1994/07/22 08:42:54 vixie Exp $"; +static char rcsid[] = "$Id: gethostbydns.c,v 1.1 1994/09/25 02:12:05 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -327,10 +327,8 @@ gethostanswer(answer, anslen, qname, qclass, qtype) bp += sizeof(align) - ((u_long)bp % sizeof(align)); if (bp + n >= &hostbuf[sizeof hostbuf]) { -#ifdef DEBUG if (_res.options & RES_DEBUG) printf("size (%d) too big\n", n); -#endif had_error++; continue; } @@ -417,10 +415,8 @@ _gethostbydnsname(name) } if ((n = res_search(name, C_IN, T_A, buf.buf, sizeof(buf))) < 0) { -#ifdef DEBUG if (_res.options & RES_DEBUG) printf("res_search failed\n"); -#endif return (NULL); } return (gethostanswer(&buf, n, name, C_IN, T_A)); @@ -445,10 +441,8 @@ _gethostbydnsaddr(addr, len, type) ((unsigned)addr[0] & 0xff)); n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf); if (n < 0) { -#ifdef DEBUG if (_res.options & RES_DEBUG) printf("res_query failed\n"); -#endif return (NULL); } if (!(hp = gethostanswer(&buf, n, qbuf, C_IN, T_PTR))) diff --git a/lib/libc/net/getnetbydns.c b/lib/libc/net/getnetbydns.c index 02e5088..fbfb3c7 100644 --- a/lib/libc/net/getnetbydns.c +++ b/lib/libc/net/getnetbydns.c @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id$"; +static char rcsid[] = "$Id: getnetbydns.c,v 1.1 1994/09/25 02:12:20 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -253,10 +253,8 @@ _getnetbydnsaddr(net, net_type) } anslen = res_query(qbuf, C_IN, T_PTR, buf.buf, sizeof buf.buf); if (anslen < 0) { -#ifdef DEBUG if (_res.options & RES_DEBUG) printf("res_query failed\n"); -#endif return (NULL); } net_entry = getnetanswer(&buf, anslen, BYADDR); @@ -283,10 +281,8 @@ _getnetbydnsname(net) (void)strcpy(&qbuf[0],net); anslen = res_search(qbuf, C_IN, T_PTR, buf.buf, sizeof buf.buf); if (anslen < 0) { -#ifdef DEBUG if (_res.options & RES_DEBUG) printf("res_query failed\n"); -#endif return NULL; } return getnetanswer(&buf, anslen, BYNAME); diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c index e32f8d3..1b1613f 100644 --- a/lib/libc/net/res_init.c +++ b/lib/libc/net/res_init.c @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; -static char rcsid[] = "$Id: res_init.c,v 4.9.1.12 1994/06/11 22:05:04 vixie Exp $"; +static char rcsid[] = "$Id: res_init.c,v 1.2 1994/09/25 02:12:36 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -341,7 +341,6 @@ res_init() dots--; } *pp = NULL; -#ifdef DEBUG if (_res.options & RES_DEBUG) { printf(";; res_init()... default dnsrch list:\n"); for (pp = _res.dnsrch; *pp; pp++) { @@ -349,7 +348,6 @@ res_init() } printf(";;\t..END..\n"); } -#endif /*DEBUG*/ #endif /*!RFC1535*/ } @@ -368,12 +366,10 @@ res_setoptions(options, source) char *cp = options; int i; -#ifdef DEBUG if (_res.options & RES_DEBUG) { printf(";; res_setoptions(\"%s\", \"%s\")...\n", options, source); } -#endif while (*cp) { /* skip leading and inner runs of spaces */ while (*cp == ' ' || *cp == '\t') @@ -385,20 +381,16 @@ res_setoptions(options, source) _res.ndots = i; else _res.ndots = RES_MAXNDOTS; -#ifdef DEBUG if (_res.options & RES_DEBUG) { printf(";;\tndots=%d\n", _res.ndots); } -#endif } else if (!strncmp(cp, "debug", sizeof("debug")-1)) { -#ifdef DEBUG if (!(_res.options & RES_DEBUG)) { printf(";; res_setoptions(\"%s\", \"%s\")..\n", options, source); _res.options |= RES_DEBUG; } printf(";;\tdebug\n"); -#endif } else { /* XXX - print a warning here? */ } diff --git a/lib/libc/net/res_mkquery.c b/lib/libc/net/res_mkquery.c index f89b1c9..7007edb 100644 --- a/lib/libc/net/res_mkquery.c +++ b/lib/libc/net/res_mkquery.c @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_mkquery.c,v 4.9.1.7 1994/06/01 21:09:58 vixie Exp $"; +static char rcsid[] = "$Id: res_mkquery.c,v 1.2 1994/09/25 02:12:38 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -85,11 +85,9 @@ res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen) struct rrec *newrr = (struct rrec *) newrr_in; u_char *dnptrs[20], **dpp, **lastdnptr; -#ifdef DEBUG if (_res.options & RES_DEBUG) printf(";; res_mkquery(%d, %s, %d, %d)\n", op, dname, class, type); -#endif /* * Initialize header fields. */ diff --git a/lib/libc/net/res_query.c b/lib/libc/net/res_query.c index 17318b7..51e13e7 100644 --- a/lib/libc/net/res_query.c +++ b/lib/libc/net/res_query.c @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_query.c,v 4.9.1.13 1994/06/11 22:05:04 vixie Exp $"; +static char rcsid[] = "$Id: res_query.c,v 1.2 1994/09/25 02:12:41 pst Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -111,37 +111,29 @@ res_query(name, class, type, answer, anslen) if ((_res.options & RES_INIT) == 0 && res_init() == -1) return (-1); -#ifdef DEBUG if (_res.options & RES_DEBUG) printf(";; res_query(%s, %d, %d)\n", name, class, type); -#endif n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL, buf, sizeof(buf)); if (n <= 0) { -#ifdef DEBUG if (_res.options & RES_DEBUG) printf(";; res_query: mkquery failed\n"); -#endif h_errno = NO_RECOVERY; return (n); } n = res_send(buf, n, answer, anslen); if (n < 0) { -#ifdef DEBUG if (_res.options & RES_DEBUG) printf(";; res_query: send error\n"); -#endif h_errno = TRY_AGAIN; return (n); } if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) { -#ifdef DEBUG if (_res.options & RES_DEBUG) printf(";; rcode = %d, ancount=%d\n", hp->rcode, ntohs(hp->ancount)); -#endif switch (hp->rcode) { case NXDOMAIN: h_errno = HOST_NOT_FOUND; @@ -321,11 +313,9 @@ res_querydomain(name, domain, class, type, answer, anslen) const char *longname = nbuf; int n; -#ifdef DEBUG if (_res.options & RES_DEBUG) printf(";; res_querydomain(%s, %s, %d, %d)\n", name, domain?domain:"<Nil>", class, type); -#endif if (domain == NULL) { /* * Check for trailing '.'; diff --git a/lib/libc/net/res_send.c b/lib/libc/net/res_send.c index 8abcd0a..a694b5e 100644 --- a/lib/libc/net/res_send.c +++ b/lib/libc/net/res_send.c @@ -53,7 +53,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93"; -static char rcsid[] = "$Id: res_send.c,v 4.9.1.12 1994/06/26 04:00:18 vixie Exp $"; +static char rcsid[] = "$Id: res_send.c,v 1.2 1994/09/25 02:12:49 pst Exp $"; #endif /* LIBC_SCCS and not lint */ /* change this to "0" @@ -87,50 +87,45 @@ static int s = -1; /* socket used for communications */ static int connected = 0; /* is the socket connected */ static int vc = 0; /* is the socket a virtual ciruit? */ -#ifndef DEBUG -# define Dprint(cond, args) /*empty*/ -# define DprintQ(cond, args, query) /*empty*/ -# define Aerror(file, string, error, address) /*empty*/ -# define Perror(file, string, error) /*empty*/ -#else # define Dprint(cond, args) if (cond) {fprintf args;} else {} # define DprintQ(cond, args, query) if (cond) {\ fprintf args;\ __p_query(query);\ } else {} - static void - Aerror(file, string, error, address) - FILE *file; - char *string; - int error; - struct sockaddr_in address; - { - int save = errno; - - if (_res.options & RES_DEBUG) { - fprintf(file, "res_send: %s ([%s].%d): %s\n", - string, - inet_ntoa(address.sin_addr), - address.sin_port, - strerror(error)); - } - errno = save; + +static void +Aerror(file, string, error, address) + FILE *file; + char *string; + int error; + struct sockaddr_in address; +{ + int save = errno; + + if (_res.options & RES_DEBUG) { + fprintf(file, "res_send: %s ([%s].%d): %s\n", + string, + inet_ntoa(address.sin_addr), + address.sin_port, + strerror(error)); } - static void - Perror(file, string, error) - FILE *file; - char *string; - int error; - { - int save = errno; - - if (_res.options & RES_DEBUG) { - fprintf(file, "res_send: %s: %s\n", - string, strerror(error)); - } - errno = save; + errno = save; +} + +static void +Perror(file, string, error) + FILE *file; + char *string; + int error; +{ + int save = errno; + + if (_res.options & RES_DEBUG) { + fprintf(file, "res_send: %s: %s\n", + string, strerror(error)); } -#endif + errno = save; +} static res_send_qhook Qhook = NULL; static res_send_rhook Rhook = NULL; |