integrate changes from bind 4.9 (most of them); continue to use address
[unix-history] / usr / src / lib / libc / net / res_query.c
index ef1e24b..7b39e1f 100644 (file)
@@ -1,12 +1,33 @@
-/*
+/*-
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
  *
  * %sccs.include.redist.c%
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
  *
  * %sccs.include.redist.c%
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ * 
+ * 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, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION 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.
+ * -
+ * --Copyright--
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_query.c        5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)res_query.c        5.12 (Berkeley) %G%";
+static char rcsid[] = "$Id: res_query.c,v 1.1 1993/06/01 09:42:14 vixie Exp vixie $";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
@@ -52,7 +73,7 @@ res_query(name, class, type, answer, anslen)
                return (-1);
 #ifdef DEBUG
        if (_res.options & RES_DEBUG)
                return (-1);
 #ifdef DEBUG
        if (_res.options & RES_DEBUG)
-               printf("res_query(%s, %d, %d)\n", name, class, type);
+               printf(";; res_query(%s, %d, %d)\n", name, class, type);
 #endif
        n = res_mkquery(QUERY, name, class, type, (char *)NULL, 0, NULL,
            buf, sizeof(buf));
 #endif
        n = res_mkquery(QUERY, name, class, type, (char *)NULL, 0, NULL,
            buf, sizeof(buf));
@@ -60,7 +81,7 @@ res_query(name, class, type, answer, anslen)
        if (n <= 0) {
 #ifdef DEBUG
                if (_res.options & RES_DEBUG)
        if (n <= 0) {
 #ifdef DEBUG
                if (_res.options & RES_DEBUG)
-                       printf("res_query: mkquery failed\n");
+                       printf(";; res_query: mkquery failed\n");
 #endif
                h_errno = NO_RECOVERY;
                return (n);
 #endif
                h_errno = NO_RECOVERY;
                return (n);
@@ -69,7 +90,7 @@ res_query(name, class, type, answer, anslen)
        if (n < 0) {
 #ifdef DEBUG
                if (_res.options & RES_DEBUG)
        if (n < 0) {
 #ifdef DEBUG
                if (_res.options & RES_DEBUG)
-                       printf("res_query: send error\n");
+                       printf(";; res_query: send error\n");
 #endif
                h_errno = TRY_AGAIN;
                return(n);
 #endif
                h_errno = TRY_AGAIN;
                return(n);
@@ -79,7 +100,7 @@ res_query(name, class, type, answer, anslen)
        if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
 #ifdef DEBUG
                if (_res.options & RES_DEBUG)
        if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
 #ifdef DEBUG
                if (_res.options & RES_DEBUG)
-                       printf("rcode = %d, ancount=%d\n", hp->rcode,
+                       printf(";; rcode = %d, ancount=%d\n", hp->rcode,
                            ntohs(hp->ancount));
 #endif
                switch (hp->rcode) {
                            ntohs(hp->ancount));
 #endif
                switch (hp->rcode) {
@@ -112,6 +133,7 @@ res_query(name, class, type, answer, anslen)
  * Only useful for queries in the same name hierarchy as the local host
  * (not, for example, for host address-to-name lookups in domain in-addr.arpa).
  */
  * Only useful for queries in the same name hierarchy as the local host
  * (not, for example, for host address-to-name lookups in domain in-addr.arpa).
  */
+int
 res_search(name, class, type, answer, anslen)
        char *name;             /* domain name */
        int class, type;        /* class and type of query */
 res_search(name, class, type, answer, anslen)
        char *name;             /* domain name */
        int class, type;        /* class and type of query */
@@ -126,7 +148,7 @@ res_search(name, class, type, answer, anslen)
                return (-1);
 
        errno = 0;
                return (-1);
 
        errno = 0;
-       h_errno = HOST_NOT_FOUND;               /* default, if we never query */
+       h_errno = HOST_NOT_FOUND;       /* default, if we never query */
        for (cp = name, n = 0; *cp; cp++)
                if (*cp == '.')
                        n++;
        for (cp = name, n = 0; *cp; cp++)
                if (*cp == '.')
                        n++;
@@ -199,7 +221,7 @@ res_querydomain(name, domain, class, type, answer, anslen)
 
 #ifdef DEBUG
        if (_res.options & RES_DEBUG)
 
 #ifdef DEBUG
        if (_res.options & RES_DEBUG)
-               printf("res_querydomain(%s, %s, %d, %d)\n",
+               printf(";; res_querydomain(%s, %s, %d, %d)\n",
                    name, domain, class, type);
 #endif
        if (domain == NULL) {
                    name, domain, class, type);
 #endif
        if (domain == NULL) {