SCCS id got lost along the way
[unix-history] / usr / src / lib / libc / net / res_comp.c
index 497d921..f1b2826 100644 (file)
@@ -6,12 +6,14 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_comp.c 6.19 (Berkeley) %G%";
+static char sccsid[] = "@(#)res_comp.c 6.22 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <sys/types.h>
-#include <stdio.h>
+#include <sys/param.h>
 #include <arpa/nameser.h>
 #include <arpa/nameser.h>
+#include <netinet/in.h>
+#include <resolv.h>
+#include <stdio.h>
 
 static dn_find();
 
 
 static dn_find();
 
@@ -23,7 +25,8 @@ static dn_find();
  * Return size of compressed name or -1 if there was an error.
  */
 dn_expand(msg, eomorig, comp_dn, exp_dn, length)
  * Return size of compressed name or -1 if there was an error.
  */
 dn_expand(msg, eomorig, comp_dn, exp_dn, length)
-       u_char *msg, *eomorig, *comp_dn, *exp_dn;
+       const u_char *msg, *eomorig, *comp_dn;
+       u_char *exp_dn;
        int length;
 {
        register u_char *cp, *dn;
        int length;
 {
        register u_char *cp, *dn;
@@ -32,7 +35,7 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
        int len = -1, checked = 0;
 
        dn = exp_dn;
        int len = -1, checked = 0;
 
        dn = exp_dn;
-       cp = comp_dn;
+       cp = (u_char *)comp_dn;
        eom = exp_dn + length;
        /*
         * fetch next label in domain name
        eom = exp_dn + length;
        /*
         * fetch next label in domain name
@@ -66,7 +69,7 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
                case INDIR_MASK:
                        if (len < 0)
                                len = cp - comp_dn + 1;
                case INDIR_MASK:
                        if (len < 0)
                                len = cp - comp_dn + 1;
-                       cp = msg + (((n & 0x3f) << 8) | (*cp & 0xff));
+                       cp = (u_char *)msg + (((n & 0x3f) << 8) | (*cp & 0xff));
                        if (cp < msg || cp >= eomorig)  /* out of range */
                                return(-1);
                        checked += 2;
                        if (cp < msg || cp >= eomorig)  /* out of range */
                                return(-1);
                        checked += 2;
@@ -102,16 +105,16 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
  * is NULL, we don't update the list.
  */
 dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
  * is NULL, we don't update the list.
  */
 dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
-       u_char *exp_dn, *comp_dn;
+       const u_char *exp_dn;
+       u_char *comp_dn, **dnptrs, **lastdnptr;
        int length;
        int length;
-       u_char **dnptrs, **lastdnptr;
 {
        register u_char *cp, *dn;
        register int c, l;
        u_char **cpp, **lpp, *sp, *eob;
        u_char *msg;
 
 {
        register u_char *cp, *dn;
        register int c, l;
        u_char **cpp, **lpp, *sp, *eob;
        u_char *msg;
 
-       dn = exp_dn;
+       dn = (u_char *)exp_dn;
        cp = comp_dn;
        eob = cp + length;
        if (dnptrs != NULL) {
        cp = comp_dn;
        eob = cp + length;
        if (dnptrs != NULL) {
@@ -180,12 +183,12 @@ dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
  * Skip over a compressed domain name. Return the size or -1.
  */
 __dn_skipname(comp_dn, eom)
  * Skip over a compressed domain name. Return the size or -1.
  */
 __dn_skipname(comp_dn, eom)
-       u_char *comp_dn, *eom;
+       const u_char *comp_dn, *eom;
 {
        register u_char *cp;
        register int n;
 
 {
        register u_char *cp;
        register int n;
 
-       cp = comp_dn;
+       cp = (u_char *)comp_dn;
        while (cp < eom && (n = *cp++)) {
                /*
                 * check for indirection
        while (cp < eom && (n = *cp++)) {
                /*
                 * check for indirection
@@ -295,14 +298,20 @@ _getlong(msgp)
        return (u | *p);
 }
 
        return (u | *p);
 }
 
+void
+#ifdef __STDC__
+__putshort(register u_short s, register u_char *msgp)
+#else
 __putshort(s, msgp)
        register u_short s;
        register u_char *msgp;
 __putshort(s, msgp)
        register u_short s;
        register u_char *msgp;
+#endif
 {
        msgp[1] = s;
        msgp[0] = s >> 8;
 }
 
 {
        msgp[1] = s;
        msgp[0] = s >> 8;
 }
 
+void
 __putlong(l, msgp)
        register u_long l;
        register u_char *msgp;
 __putlong(l, msgp)
        register u_long l;
        register u_char *msgp;