Add include files to get prototype declarations, and fix bugs found.
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 25 Feb 1991 04:40:31 +0000 (20:40 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Mon, 25 Feb 1991 04:40:31 +0000 (20:40 -0800)
SCCS-vsn: lib/libc/net/gethostnamadr.c 6.43
SCCS-vsn: lib/libc/net/getnetbyname.c 5.7
SCCS-vsn: lib/libc/net/getnetent.c 5.8
SCCS-vsn: lib/libc/net/getprotoent.c 5.8
SCCS-vsn: lib/libc/net/getprotoname.c 5.7
SCCS-vsn: lib/libc/net/getservbyname.c 5.7
SCCS-vsn: lib/libc/net/getservbyport.c 5.7
SCCS-vsn: lib/libc/net/getservent.c 5.9
SCCS-vsn: lib/libc/net/herror.c 6.6
SCCS-vsn: lib/libc/net/inet_addr.c 5.9
SCCS-vsn: lib/libc/net/inet_lnaof.c 5.7
SCCS-vsn: lib/libc/net/inet_makeaddr.c 5.6
SCCS-vsn: lib/libc/net/inet_netof.c 5.7
SCCS-vsn: lib/libc/net/inet_network.c 5.7
SCCS-vsn: lib/libc/net/inet_ntoa.c 5.6
SCCS-vsn: lib/libc/net/iso_addr.c 5.4
SCCS-vsn: lib/libc/net/linkaddr.c 5.2
SCCS-vsn: lib/libc/net/ns_addr.c 6.7
SCCS-vsn: lib/libc/net/ns_ntoa.c 6.6
SCCS-vsn: lib/libc/net/rcmd.c 5.23
SCCS-vsn: lib/libc/net/recv.c 5.3
SCCS-vsn: lib/libc/net/res_comp.c 6.20
SCCS-vsn: lib/libc/net/res_debug.c 5.33
SCCS-vsn: lib/libc/net/res_init.c 6.15
SCCS-vsn: lib/libc/net/res_mkquery.c 6.15
SCCS-vsn: lib/libc/net/res_query.c 5.9
SCCS-vsn: lib/libc/net/res_send.c 6.27
SCCS-vsn: lib/libc/net/send.c 5.3
SCCS-vsn: lib/libc/net/sethostent.c 6.8

29 files changed:
usr/src/lib/libc/net/gethostnamadr.c
usr/src/lib/libc/net/getnetbyname.c
usr/src/lib/libc/net/getnetent.c
usr/src/lib/libc/net/getprotoent.c
usr/src/lib/libc/net/getprotoname.c
usr/src/lib/libc/net/getservbyname.c
usr/src/lib/libc/net/getservbyport.c
usr/src/lib/libc/net/getservent.c
usr/src/lib/libc/net/herror.c
usr/src/lib/libc/net/inet_addr.c
usr/src/lib/libc/net/inet_lnaof.c
usr/src/lib/libc/net/inet_makeaddr.c
usr/src/lib/libc/net/inet_netof.c
usr/src/lib/libc/net/inet_network.c
usr/src/lib/libc/net/inet_ntoa.c
usr/src/lib/libc/net/iso_addr.c
usr/src/lib/libc/net/linkaddr.c
usr/src/lib/libc/net/ns_addr.c
usr/src/lib/libc/net/ns_ntoa.c
usr/src/lib/libc/net/rcmd.c
usr/src/lib/libc/net/recv.c
usr/src/lib/libc/net/res_comp.c
usr/src/lib/libc/net/res_debug.c
usr/src/lib/libc/net/res_init.c
usr/src/lib/libc/net/res_mkquery.c
usr/src/lib/libc/net/res_query.c
usr/src/lib/libc/net/res_send.c
usr/src/lib/libc/net/send.c
usr/src/lib/libc/net/sethostent.c

index b044261..3f3ba05 100644 (file)
@@ -6,19 +6,20 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gethostnamadr.c    6.42 (Berkeley) %G%";
+static char sccsid[] = "@(#)gethostnamadr.c    6.43 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#include <ctype.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <errno.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
+#include <netdb.h>
 #include <resolv.h>
 #include <resolv.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
 
 #define        MAXALIASES      35
 #define        MAXADDRS        35
 
 #define        MAXALIASES      35
 #define        MAXADDRS        35
@@ -51,9 +52,7 @@ typedef union {
     char ac;
 } align;
 
     char ac;
 } align;
 
-
 int h_errno;
 int h_errno;
-extern errno;
 
 static struct hostent *
 getanswer(answer, anslen, iquery)
 
 static struct hostent *
 getanswer(answer, anslen, iquery)
@@ -82,8 +81,9 @@ getanswer(answer, anslen, iquery)
        cp = answer->buf + sizeof(HEADER);
        if (qdcount) {
                if (iquery) {
        cp = answer->buf + sizeof(HEADER);
        if (qdcount) {
                if (iquery) {
-                       if ((n = dn_expand((char *)answer->buf, eom,
-                            cp, bp, buflen)) < 0) {
+                       if ((n = dn_expand((u_char *)answer->buf,
+                           (u_char *)eom, (u_char *)cp, (u_char *)bp,
+                           buflen)) < 0) {
                                h_errno = NO_RECOVERY;
                                return ((struct hostent *) NULL);
                        }
                                h_errno = NO_RECOVERY;
                                return ((struct hostent *) NULL);
                        }
@@ -113,7 +113,8 @@ getanswer(answer, anslen, iquery)
 #endif
        haveanswer = 0;
        while (--ancount >= 0 && cp < eom) {
 #endif
        haveanswer = 0;
        while (--ancount >= 0 && cp < eom) {
-               if ((n = dn_expand((char *)answer->buf, eom, cp, bp, buflen)) < 0)
+               if ((n = dn_expand((u_char *)answer->buf, (u_char *)eom,
+                   (u_char *)cp, (u_char *)bp, buflen)) < 0)
                        break;
                cp += n;
                type = _getshort(cp);
                        break;
                cp += n;
                type = _getshort(cp);
@@ -133,8 +134,9 @@ getanswer(answer, anslen, iquery)
                        continue;
                }
                if (iquery && type == T_PTR) {
                        continue;
                }
                if (iquery && type == T_PTR) {
-                       if ((n = dn_expand((char *)answer->buf, eom,
-                           cp, bp, buflen)) < 0) {
+                       if ((n = dn_expand((u_char *)answer->buf,
+                           (u_char *)eom, (u_char *)cp, (u_char *)bp,
+                           buflen)) < 0) {
                                cp += n;
                                continue;
                        }
                                cp += n;
                                continue;
                        }
@@ -260,7 +262,7 @@ gethostbyname(name)
 
 struct hostent *
 gethostbyaddr(addr, len, type)
 
 struct hostent *
 gethostbyaddr(addr, len, type)
-       char *addr;
+       const char *addr;
        int len, type;
 {
        int n;
        int len, type;
 {
        int n;
@@ -391,7 +393,7 @@ found:
 
 struct hostent *
 _gethtbyaddr(addr, len, type)
 
 struct hostent *
 _gethtbyaddr(addr, len, type)
-       char *addr;
+       const char *addr;
        int len, type;
 {
        register struct hostent *p;
        int len, type;
 {
        register struct hostent *p;
index 4662ba3..e232f51 100644 (file)
@@ -6,16 +6,17 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetbyname.c     5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)getnetbyname.c     5.7 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <netdb.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <netdb.h>
+#include <string.h>
 
 extern int _net_stayopen;
 
 struct netent *
 getnetbyname(name)
 
 extern int _net_stayopen;
 
 struct netent *
 getnetbyname(name)
-       register char *name;
+       register const char *name;
 {
        register struct netent *p;
        register char **cp;
 {
        register struct netent *p;
        register char **cp;
index 6cec19f..affab84 100644 (file)
@@ -6,24 +6,26 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetent.c        5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)getnetent.c        5.8 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <stdio.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 #include <netdb.h>
 #include <netdb.h>
-#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
 
 #define        MAXALIASES      35
 
 
 #define        MAXALIASES      35
 
-static FILE *netf = NULL;
+static FILE *netf;
 static char line[BUFSIZ+1];
 static struct netent net;
 static char *net_aliases[MAXALIASES];
 int _net_stayopen;
 static char line[BUFSIZ+1];
 static struct netent net;
 static char *net_aliases[MAXALIASES];
 int _net_stayopen;
-static char *any();
 
 
+void
 setnetent(f)
        int f;
 {
 setnetent(f)
        int f;
 {
@@ -34,6 +36,7 @@ setnetent(f)
        _net_stayopen |= f;
 }
 
        _net_stayopen |= f;
 }
 
+void
 endnetent()
 {
        if (netf) {
 endnetent()
 {
        if (netf) {
@@ -57,18 +60,18 @@ again:
                return (NULL);
        if (*p == '#')
                goto again;
                return (NULL);
        if (*p == '#')
                goto again;
-       cp = any(p, "#\n");
+       cp = strpbrk(p, "#\n");
        if (cp == NULL)
                goto again;
        *cp = '\0';
        net.n_name = p;
        if (cp == NULL)
                goto again;
        *cp = '\0';
        net.n_name = p;
-       cp = any(p, " \t");
+       cp = strpbrk(p, " \t");
        if (cp == NULL)
                goto again;
        *cp++ = '\0';
        while (*cp == ' ' || *cp == '\t')
                cp++;
        if (cp == NULL)
                goto again;
        *cp++ = '\0';
        while (*cp == ' ' || *cp == '\t')
                cp++;
-       p = any(cp, " \t");
+       p = strpbrk(cp, " \t");
        if (p != NULL)
                *p++ = '\0';
        net.n_net = inet_network(cp);
        if (p != NULL)
                *p++ = '\0';
        net.n_net = inet_network(cp);
@@ -83,26 +86,10 @@ again:
                }
                if (q < &net_aliases[MAXALIASES - 1])
                        *q++ = cp;
                }
                if (q < &net_aliases[MAXALIASES - 1])
                        *q++ = cp;
-               cp = any(cp, " \t");
+               cp = strpbrk(cp, " \t");
                if (cp != NULL)
                        *cp++ = '\0';
        }
        *q = NULL;
        return (&net);
 }
                if (cp != NULL)
                        *cp++ = '\0';
        }
        *q = NULL;
        return (&net);
 }
-
-static char *
-any(cp, match)
-       register char *cp;
-       char *match;
-{
-       register char *mp, c;
-
-       while (c = *cp) {
-               for (mp = match; *mp; mp++)
-                       if (*mp == c)
-                               return (cp);
-               cp++;
-       }
-       return ((char *)0);
-}
index ab4cb28..833c6df 100644 (file)
@@ -6,14 +6,15 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getprotoent.c      5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)getprotoent.c      5.8 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <stdio.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
-#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #define        MAXALIASES      35
 
 
 #define        MAXALIASES      35
 
@@ -21,9 +22,9 @@ static FILE *protof = NULL;
 static char line[BUFSIZ+1];
 static struct protoent proto;
 static char *proto_aliases[MAXALIASES];
 static char line[BUFSIZ+1];
 static struct protoent proto;
 static char *proto_aliases[MAXALIASES];
-static char *any();
 int _proto_stayopen;
 
 int _proto_stayopen;
 
+void
 setprotoent(f)
        int f;
 {
 setprotoent(f)
        int f;
 {
@@ -34,6 +35,7 @@ setprotoent(f)
        _proto_stayopen |= f;
 }
 
        _proto_stayopen |= f;
 }
 
+void
 endprotoent()
 {
        if (protof) {
 endprotoent()
 {
        if (protof) {
@@ -56,18 +58,18 @@ again:
                return (NULL);
        if (*p == '#')
                goto again;
                return (NULL);
        if (*p == '#')
                goto again;
-       cp = any(p, "#\n");
+       cp = strpbrk(p, "#\n");
        if (cp == NULL)
                goto again;
        *cp = '\0';
        proto.p_name = p;
        if (cp == NULL)
                goto again;
        *cp = '\0';
        proto.p_name = p;
-       cp = any(p, " \t");
+       cp = strpbrk(p, " \t");
        if (cp == NULL)
                goto again;
        *cp++ = '\0';
        while (*cp == ' ' || *cp == '\t')
                cp++;
        if (cp == NULL)
                goto again;
        *cp++ = '\0';
        while (*cp == ' ' || *cp == '\t')
                cp++;
-       p = any(cp, " \t");
+       p = strpbrk(cp, " \t");
        if (p != NULL)
                *p++ = '\0';
        proto.p_proto = atoi(cp);
        if (p != NULL)
                *p++ = '\0';
        proto.p_proto = atoi(cp);
@@ -81,7 +83,7 @@ again:
                        }
                        if (q < &proto_aliases[MAXALIASES - 1])
                                *q++ = cp;
                        }
                        if (q < &proto_aliases[MAXALIASES - 1])
                                *q++ = cp;
-                       cp = any(cp, " \t");
+                       cp = strpbrk(cp, " \t");
                        if (cp != NULL)
                                *cp++ = '\0';
                }
                        if (cp != NULL)
                                *cp++ = '\0';
                }
@@ -89,19 +91,3 @@ again:
        *q = NULL;
        return (&proto);
 }
        *q = NULL;
        return (&proto);
 }
-
-static char *
-any(cp, match)
-       register char *cp;
-       char *match;
-{
-       register char *mp, c;
-
-       while (c = *cp) {
-               for (mp = match; *mp; mp++)
-                       if (*mp == c)
-                               return (cp);
-               cp++;
-       }
-       return ((char *)0);
-}
index 65f136b..963ac9d 100644 (file)
@@ -6,16 +6,17 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getprotoname.c     5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)getprotoname.c     5.7 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <netdb.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <netdb.h>
+#include <string.h>
 
 extern int _proto_stayopen;
 
 struct protoent *
 getprotobyname(name)
 
 extern int _proto_stayopen;
 
 struct protoent *
 getprotobyname(name)
-       register char *name;
+       register const char *name;
 {
        register struct protoent *p;
        register char **cp;
 {
        register struct protoent *p;
        register char **cp;
index adeefe7..0a39021 100644 (file)
@@ -6,16 +6,17 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getservbyname.c    5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)getservbyname.c    5.7 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <netdb.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <netdb.h>
+#include <string.h>
 
 extern int _serv_stayopen;
 
 struct servent *
 getservbyname(name, proto)
 
 extern int _serv_stayopen;
 
 struct servent *
 getservbyname(name, proto)
-       char *name, *proto;
+       const char *name, *proto;
 {
        register struct servent *p;
        register char **cp;
 {
        register struct servent *p;
        register char **cp;
index 719bdb9..6e8b8d2 100644 (file)
@@ -6,17 +6,18 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getservbyport.c    5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)getservbyport.c    5.7 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <netdb.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <netdb.h>
+#include <string.h>
 
 extern int _serv_stayopen;
 
 struct servent *
 getservbyport(port, proto)
        int port;
 
 extern int _serv_stayopen;
 
 struct servent *
 getservbyport(port, proto)
        int port;
-       char *proto;
+       const char *proto;
 {
        register struct servent *p;
 
 {
        register struct servent *p;
 
index 8ba5271..851484b 100644 (file)
@@ -6,15 +6,15 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getservent.c       5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)getservent.c       5.9 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <stdio.h>
-#include <sys/param.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
-#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
 
 #define        MAXALIASES      35
 
 
 #define        MAXALIASES      35
 
@@ -22,9 +22,9 @@ static FILE *servf = NULL;
 static char line[BUFSIZ+1];
 static struct servent serv;
 static char *serv_aliases[MAXALIASES];
 static char line[BUFSIZ+1];
 static struct servent serv;
 static char *serv_aliases[MAXALIASES];
-static char *any();
 int _serv_stayopen;
 
 int _serv_stayopen;
 
+void
 setservent(f)
        int f;
 {
 setservent(f)
        int f;
 {
@@ -35,6 +35,7 @@ setservent(f)
        _serv_stayopen |= f;
 }
 
        _serv_stayopen |= f;
 }
 
+void
 endservent()
 {
        if (servf) {
 endservent()
 {
        if (servf) {
@@ -57,25 +58,25 @@ again:
                return (NULL);
        if (*p == '#')
                goto again;
                return (NULL);
        if (*p == '#')
                goto again;
-       cp = any(p, "#\n");
+       cp = strpbrk(p, "#\n");
        if (cp == NULL)
                goto again;
        *cp = '\0';
        serv.s_name = p;
        if (cp == NULL)
                goto again;
        *cp = '\0';
        serv.s_name = p;
-       p = any(p, " \t");
+       p = strpbrk(p, " \t");
        if (p == NULL)
                goto again;
        *p++ = '\0';
        while (*p == ' ' || *p == '\t')
                p++;
        if (p == NULL)
                goto again;
        *p++ = '\0';
        while (*p == ' ' || *p == '\t')
                p++;
-       cp = any(p, ",/");
+       cp = strpbrk(p, ",/");
        if (cp == NULL)
                goto again;
        *cp++ = '\0';
        serv.s_port = htons((u_short)atoi(p));
        serv.s_proto = cp;
        q = serv.s_aliases = serv_aliases;
        if (cp == NULL)
                goto again;
        *cp++ = '\0';
        serv.s_port = htons((u_short)atoi(p));
        serv.s_proto = cp;
        q = serv.s_aliases = serv_aliases;
-       cp = any(cp, " \t");
+       cp = strpbrk(cp, " \t");
        if (cp != NULL)
                *cp++ = '\0';
        while (cp && *cp) {
        if (cp != NULL)
                *cp++ = '\0';
        while (cp && *cp) {
@@ -85,26 +86,10 @@ again:
                }
                if (q < &serv_aliases[MAXALIASES - 1])
                        *q++ = cp;
                }
                if (q < &serv_aliases[MAXALIASES - 1])
                        *q++ = cp;
-               cp = any(cp, " \t");
+               cp = strpbrk(cp, " \t");
                if (cp != NULL)
                        *cp++ = '\0';
        }
        *q = NULL;
        return (&serv);
 }
                if (cp != NULL)
                        *cp++ = '\0';
        }
        *q = NULL;
        return (&serv);
 }
-
-static char *
-any(cp, match)
-       register char *cp;
-       char *match;
-{
-       register char *mp, c;
-
-       while (c = *cp) {
-               for (mp = match; *mp; mp++)
-                       if (*mp == c)
-                               return (cp);
-               cp++;
-       }
-       return ((char *)0);
-}
index 77e392b..ff8ef85 100644 (file)
@@ -6,11 +6,14 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)herror.c   6.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)herror.c   6.6 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <sys/uio.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <sys/uio.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <string.h>
 
 char   *h_errlist[] = {
        "Error 0",
 
 char   *h_errlist[] = {
        "Error 0",
@@ -27,14 +30,15 @@ extern int  h_errno;
  * herror --
  *     print the error indicated by the h_errno value.
  */
  * herror --
  *     print the error indicated by the h_errno value.
  */
+void
 herror(s)
 herror(s)
-       char *s;
+       const char *s;
 {
        struct iovec iov[4];
        register struct iovec *v = iov;
 
        if (s && *s) {
 {
        struct iovec iov[4];
        register struct iovec *v = iov;
 
        if (s && *s) {
-               v->iov_base = s;
+               v->iov_base = (char *)s;
                v->iov_len = strlen(s);
                v++;
                v->iov_base = ": ";
                v->iov_len = strlen(s);
                v++;
                v->iov_base = ": ";
@@ -47,5 +51,5 @@ herror(s)
        v++;
        v->iov_base = "\n";
        v->iov_len = 1;
        v++;
        v->iov_base = "\n";
        v->iov_len = 1;
-       writev(2, iov, (v - iov) + 1);
+       writev(STDERR_FILENO, iov, (v - iov) + 1);
 }
 }
index c560a76..8ffe47f 100644 (file)
@@ -6,12 +6,12 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_addr.c        5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)inet_addr.c        5.9 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <sys/types.h>
-#include <ctype.h>
+#include <sys/param.h>
 #include <netinet/in.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 
 /*
  * Ascii internet address interpretation routine.
 
 /*
  * Ascii internet address interpretation routine.
@@ -19,7 +19,7 @@ static char sccsid[] = "@(#)inet_addr.c       5.8 (Berkeley) %G%";
  */
 u_long
 inet_addr(cp)
  */
 u_long
 inet_addr(cp)
-       register char *cp;
+       register const char *cp;
 {
        struct in_addr val;
 
 {
        struct in_addr val;
 
index 9b4ca77..8246ad6 100644 (file)
@@ -6,11 +6,12 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_lnaof.c       5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)inet_lnaof.c       5.7 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <sys/types.h>
+#include <sys/param.h>
 #include <netinet/in.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 
 /*
  * Return the local network address portion of an
 
 /*
  * Return the local network address portion of an
index edf112e..c991ed8 100644 (file)
@@ -6,11 +6,12 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_makeaddr.c    5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)inet_makeaddr.c    5.6 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <sys/types.h>
+#include <sys/param.h>
 #include <netinet/in.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 
 /*
  * Formulate an Internet address from network + host.  Used in
 
 /*
  * Formulate an Internet address from network + host.  Used in
index d389209..055f18b 100644 (file)
@@ -6,11 +6,12 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_netof.c       5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)inet_netof.c       5.7 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <sys/types.h>
+#include <sys/param.h>
 #include <netinet/in.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 
 /*
  * Return the network number from an internet
 
 /*
  * Return the network number from an internet
index 099dac3..6418ff8 100644 (file)
@@ -6,12 +6,12 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_network.c     5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)inet_network.c     5.7 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <netinet/in.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <netinet/in.h>
-#include <ctype.h>
+#include <arpa/inet.h>
 
 /*
  * Internet network address interpretation routine.
 
 /*
  * Internet network address interpretation routine.
@@ -20,7 +20,7 @@ static char sccsid[] = "@(#)inet_network.c    5.6 (Berkeley) %G%";
  */
 u_long
 inet_network(cp)
  */
 u_long
 inet_network(cp)
-       register char *cp;
+       register const char *cp;
 {
        register u_long val, base, n;
        register char c;
 {
        register u_long val, base, n;
        register char c;
index b90d79e..41fb0db 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_ntoa.c        5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)inet_ntoa.c        5.6 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 /*
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -15,6 +15,8 @@ static char sccsid[] = "@(#)inet_ntoa.c       5.5 (Berkeley) %G%";
  */
 #include <sys/types.h>
 #include <netinet/in.h>
  */
 #include <sys/types.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
+#include <stdio.h>
 
 char *
 inet_ntoa(in)
 
 char *
 inet_ntoa(in)
@@ -25,6 +27,7 @@ inet_ntoa(in)
 
        p = (char *)&in;
 #define        UC(b)   (((int)b)&0xff)
 
        p = (char *)&in;
 #define        UC(b)   (((int)b)&0xff)
-       sprintf(b, "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3]));
+       (void)snprintf(b, sizeof(b),
+           "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3]));
        return (b);
 }
        return (b);
 }
index ae97c29..0754914 100644 (file)
@@ -6,11 +6,13 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)iso_addr.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)iso_addr.c 5.4 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <netiso/iso.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <netiso/iso.h>
+#include <string.h>
+
 /* States*/
 #define VIRGIN 0
 #define GOTONE 1
 /* States*/
 #define VIRGIN 0
 #define GOTONE 1
@@ -22,7 +24,7 @@ static char sccsid[] = "@(#)iso_addr.c        5.3 (Berkeley) %G%";
 
 struct iso_addr *
 iso_addr(addr)
 
 struct iso_addr *
 iso_addr(addr)
-register char *addr;
+       register const char *addr;
 {
        static struct iso_addr out_addr;
        register char *cp = out_addr.isoa_genaddr;
 {
        static struct iso_addr out_addr;
        register char *cp = out_addr.isoa_genaddr;
@@ -66,7 +68,7 @@ static char hexlist[] = "0123456789abcdef";
 
 char *
 iso_ntoa(isoa)
 
 char *
 iso_ntoa(isoa)
-struct iso_addr *isoa;
+       const struct iso_addr *isoa;
 {
        static char obuf[64];
        register char *out = obuf; 
 {
        static char obuf[64];
        register char *out = obuf; 
index aa4e9b0..3239f17 100644 (file)
@@ -6,12 +6,13 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)linkaddr.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)linkaddr.c 5.2 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <net/if_dl.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <net/if_dl.h>
+#include <string.h>
 
 /* States*/
 #define NAMING 0
 
 /* States*/
 #define NAMING 0
@@ -24,9 +25,10 @@ static char sccsid[] = "@(#)linkaddr.c       5.1 (Berkeley) %G%";
 #define DELIM  (4*2)
 #define LETTER (4*3)
 
 #define DELIM  (4*2)
 #define LETTER (4*3)
 
+void
 link_addr(addr, sdl)
 link_addr(addr, sdl)
-register char *addr;
-register struct sockaddr_dl *sdl;
+       register const char *addr;
+       register struct sockaddr_dl *sdl;
 {
        register char *cp = sdl->sdl_data;
        char *cplim = sdl->sdl_len + (char *)sdl;
 {
        register char *cp = sdl->sdl_data;
        char *cplim = sdl->sdl_len + (char *)sdl;
@@ -84,7 +86,7 @@ static char hexlist[] = "0123456789abcdef";
 
 char *
 link_ntoa(sdl)
 
 char *
 link_ntoa(sdl)
-register struct sockaddr_dl *sdl;
+       register const struct sockaddr_dl *sdl;
 {
        static char obuf[64];
        register char *out = obuf; 
 {
        static char obuf[64];
        register char *out = obuf; 
index 912b38a..b4244dd 100644 (file)
@@ -9,25 +9,28 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ns_addr.c  6.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)ns_addr.c  6.7 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <sys/types.h>
+#include <sys/param.h>
 #include <netns/ns.h>
 #include <netns/ns.h>
+#include <stdio.h>
+#include <string.h>
 
 static struct ns_addr addr, zero_addr;
 
 
 static struct ns_addr addr, zero_addr;
 
+static void Field(), cvtbase();
+
 struct ns_addr 
 ns_addr(name)
 struct ns_addr 
 ns_addr(name)
-       char *name;
+       const char *name;
 {
 {
-       char separator = '.';
+       char separator;
        char *hostname, *socketname, *cp;
        char buf[50];
        char *hostname, *socketname, *cp;
        char buf[50];
-       extern char *index();
 
 
-       addr = zero_addr;
-       (void)strncpy(buf, name, 49);
+       (void)strncpy(buf, name, sizeof(buf - 1));
+       buf[sizeof(buf - 1)] = '\0';
 
        /*
         * First, figure out what he intends as a field separtor.
 
        /*
         * First, figure out what he intends as a field separtor.
@@ -40,13 +43,16 @@ ns_addr(name)
        else {
                hostname = index(buf, '.');
                if ((cp = index(buf, ':')) &&
        else {
                hostname = index(buf, '.');
                if ((cp = index(buf, ':')) &&
-                   ( (hostname && cp < hostname) || (hostname == 0))) {
+                   ((hostname && cp < hostname) || (hostname == 0))) {
                        hostname = cp;
                        separator = ':';
                        hostname = cp;
                        separator = ':';
-               }
+               } else
+                       separator = '.';
        }
        if (hostname)
                *hostname++ = 0;
        }
        if (hostname)
                *hostname++ = 0;
+
+       addr = zero_addr;
        Field(buf, addr.x_net.c_net, 4);
        if (hostname == 0)
                return (addr);  /* No separator means net only */
        Field(buf, addr.x_net.c_net, 4);
        if (hostname == 0)
                return (addr);  /* No separator means net only */
@@ -62,11 +68,11 @@ ns_addr(name)
        return (addr);
 }
 
        return (addr);
 }
 
-static
+static void
 Field(buf, out, len)
 Field(buf, out, len)
-char *buf;
-u_char *out;
-int len;
+       char *buf;
+       u_char *out;
+       int len;
 {
        register char *bp = buf;
        int i, ibase, base16 = 0, base10 = 0, clen = 0;
 {
        register char *bp = buf;
        int i, ibase, base16 = 0, base10 = 0, clen = 0;
@@ -166,7 +172,7 @@ int len;
        cvtbase((long)ibase, 256, hb, i, out, len);
 }
 
        cvtbase((long)ibase, 256, hb, i, out, len);
 }
 
-static
+static void
 cvtbase(oldbase,newbase,input,inlen,result,reslen)
        long oldbase;
        int newbase;
 cvtbase(oldbase,newbase,input,inlen,result,reslen)
        long oldbase;
        int newbase;
index b753e7c..fde3346 100644 (file)
@@ -6,24 +6,25 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ns_ntoa.c  6.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)ns_ntoa.c  6.6 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <sys/types.h>
+#include <sys/param.h>
 #include <netns/ns.h>
 #include <netns/ns.h>
+#include <stdio.h>
 
 char *
 ns_ntoa(addr)
 
 char *
 ns_ntoa(addr)
-struct ns_addr addr;
+       struct ns_addr addr;
 {
        static char obuf[40];
 {
        static char obuf[40];
-       char *spectHex();
        union { union ns_net net_e; u_long long_e; } net;
        u_short port = htons(addr.x_port);
        register char *cp;
        char *cp2;
        register u_char *up = addr.x_host.c_host;
        u_char *uplim = up + 6;
        union { union ns_net net_e; u_long long_e; } net;
        u_short port = htons(addr.x_port);
        register char *cp;
        char *cp2;
        register u_char *up = addr.x_host.c_host;
        u_char *uplim = up + 6;
+       static char *spectHex();
 
        net.net_e = addr.x_net;
        sprintf(obuf, "%lx", ntohl(net.long_e));
 
        net.net_e = addr.x_net;
        sprintf(obuf, "%lx", ntohl(net.long_e));
@@ -52,7 +53,7 @@ struct ns_addr addr;
 
 static char *
 spectHex(p0)
 
 static char *
 spectHex(p0)
-char *p0;
+       char *p0;
 {
        int ok = 0;
        int nonzero = 0;
 {
        int ok = 0;
        int nonzero = 0;
index 7774a8e..f146b99 100644 (file)
@@ -6,30 +6,27 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rcmd.c     5.22 (Berkeley) %G%";
+static char sccsid[] = "@(#)rcmd.c     5.23 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <stdio.h>
-#include <ctype.h>
-#include <pwd.h>
 #include <sys/param.h>
 #include <sys/param.h>
-#include <sys/file.h>
-#include <sys/signal.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
-
 #include <netinet/in.h>
 #include <netinet/in.h>
-
+#include <arpa/inet.h>
+#include <signal.h>
+#include <fcntl.h>
 #include <netdb.h>
 #include <netdb.h>
+#include <pwd.h>
 #include <errno.h>
 #include <errno.h>
-
-extern errno;
-char   *index();
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
 
 rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
        char **ahost;
        u_short rport;
 
 rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
        char **ahost;
        u_short rport;
-       char *locuser, *remuser, *cmd;
+       const char *locuser, *remuser, *cmd;
        int *fd2p;
 {
        int s, timo = 1, pid;
        int *fd2p;
 {
        int s, timo = 1, pid;
@@ -62,7 +59,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
                sin.sin_family = hp->h_addrtype;
                bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length);
                sin.sin_port = rport;
                sin.sin_family = hp->h_addrtype;
                bcopy(hp->h_addr_list[0], (caddr_t)&sin.sin_addr, hp->h_length);
                sin.sin_port = rport;
-               if (connect(s, (caddr_t)&sin, sizeof (sin), 0) >= 0)
+               if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
                        break;
                (void) close(s);
                if (errno == EADDRINUSE) {
                        break;
                (void) close(s);
                if (errno == EADDRINUSE) {
@@ -124,7 +121,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
                        (void) close(s2);
                        goto bad;
                }
                        (void) close(s2);
                        goto bad;
                }
-               s3 = accept(s2, &from, &len, 0);
+               s3 = accept(s2, (struct sockaddr *)&from, &len);
                (void) close(s2);
                if (s3 < 0) {
                        perror("accept");
                (void) close(s2);
                if (s3 < 0) {
                        perror("accept");
@@ -180,7 +177,7 @@ rresvport(alport)
                return (-1);
        for (;;) {
                sin.sin_port = htons((u_short)*alport);
                return (-1);
        for (;;) {
                sin.sin_port = htons((u_short)*alport);
-               if (bind(s, (caddr_t)&sin, sizeof (sin)) >= 0)
+               if (bind(s, (struct sockaddr *)&sin, sizeof (sin)) >= 0)
                        return (s);
                if (errno != EADDRINUSE) {
                        (void) close(s);
                        return (s);
                if (errno != EADDRINUSE) {
                        (void) close(s);
@@ -198,9 +195,8 @@ rresvport(alport)
 int    _check_rhosts_file = 1;
 
 ruserok(rhost, superuser, ruser, luser)
 int    _check_rhosts_file = 1;
 
 ruserok(rhost, superuser, ruser, luser)
-       char *rhost;
+       const char *rhost, *ruser, *luser;
        int superuser;
        int superuser;
-       char *ruser, *luser;
 {
        FILE *hostf;
        char fhost[MAXHOSTNAMELEN];
 {
        FILE *hostf;
        char fhost[MAXHOSTNAMELEN];
@@ -208,7 +204,7 @@ ruserok(rhost, superuser, ruser, luser)
        register char *sp, *p;
        int baselen = -1;
 
        register char *sp, *p;
        int baselen = -1;
 
-       sp = rhost;
+       sp = (char *)rhost;
        p = fhost;
        while (*sp) {
                if (*sp == '.') {
        p = fhost;
        while (*sp) {
                if (*sp == '.') {
@@ -262,9 +258,9 @@ _validuser(hostf, rhost, luser, ruser, baselen)
        FILE *hostf;
        int baselen;
 {
        FILE *hostf;
        int baselen;
 {
-       char *user;
-       char ahost[MAXHOSTNAMELEN];
        register char *p;
        register char *p;
+       char *user, ahost[MAXHOSTNAMELEN];
+       static int _checkhost();
 
        while (fgets(ahost, sizeof (ahost), hostf)) {
                p = ahost;
 
        while (fgets(ahost, sizeof (ahost), hostf)) {
                p = ahost;
index 579031b..035f7d7 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)recv.c     5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)recv.c     5.3 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -15,7 +15,7 @@ static char sccsid[] = "@(#)recv.c    5.2 (Berkeley) %G%";
 
 recv(s, buf, len, flags)
        int s, len, flags;
 
 recv(s, buf, len, flags)
        int s, len, flags;
-       char *buf;
+       void *buf;
 {
        return(recvfrom(s, buf, len, flags, (struct sockaddr *)NULL, 0));
 }
 {
        return(recvfrom(s, buf, len, flags, (struct sockaddr *)NULL, 0));
 }
index 497d921..a57315f 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.20 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
-#include <stdio.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) {
index df3f0e7..6b6ff2c 100644 (file)
@@ -4,19 +4,21 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)res_debug.c 5.32 (Berkeley) %G%
+ *     @(#)res_debug.c 5.33 (Berkeley) %G%
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_debug.c        5.32 (Berkeley) %G%";
+static char sccsid[] = "@(#)res_debug.c        5.33 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #include <netinet/in.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #include <netinet/in.h>
-#include <stdio.h>
+#include <arpa/inet.h>
 #include <arpa/nameser.h>
 #include <arpa/nameser.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <string.h>
 
 
-extern char *inet_ntoa();
 static char *p_cdname(), *p_class(), *p_rr(), *p_time(), *p_type();
 
 char *_res_opcodes[] = {
 static char *p_cdname(), *p_class(), *p_rr(), *p_time(), *p_type();
 
 char *_res_opcodes[] = {
@@ -60,6 +62,8 @@ char *_res_resultcodes[] = {
 __p_query(msg)
        char *msg;
 {
 __p_query(msg)
        char *msg;
 {
+       static void fp_query();
+
        fp_query(msg,stdout);
 }
 
        fp_query(msg,stdout);
 }
 
@@ -67,7 +71,7 @@ __p_query(msg)
  * Print the contents of a query.
  * This is intended to be primarily a debugging routine.
  */
  * Print the contents of a query.
  * This is intended to be primarily a debugging routine.
  */
-static
+static void
 fp_query(msg,file)
        char *msg;
        FILE *file;
 fp_query(msg,file)
        char *msg;
        FILE *file;
@@ -165,7 +169,8 @@ p_cdname(cp, msg, file)
        char name[MAXDNAME];
        int n;
 
        char name[MAXDNAME];
        int n;
 
-       if ((n = dn_expand(msg, msg + 512, cp, name, sizeof(name))) < 0)
+       if ((n = dn_expand((u_char *)msg, (u_char *)msg + 512, (u_char *)cp,
+           (u_char *)name, sizeof(name))) < 0)
                return (NULL);
        if (name[0] == '\0') {
                name[0] = '.';
                return (NULL);
        if (name[0] == '\0') {
                name[0] = '.';
index a7c5d2d..2c0c6f8 100644 (file)
@@ -6,15 +6,19 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_init.c 6.14 (Berkeley) %G%";
+static char sccsid[] = "@(#)res_init.c 6.15 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <sys/types.h>
+#include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#include <stdio.h>
+#include <arpa/inet.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 /*
  * Resolver state default settings
 
 /*
  * Resolver state default settings
@@ -43,10 +47,6 @@ res_init()
        register char *cp, **pp;
        register int n;
        char buf[BUFSIZ];
        register char *cp, **pp;
        register int n;
        char buf[BUFSIZ];
-       extern u_long inet_addr();
-       extern char *index();
-       extern char *strcpy(), *strncpy();
-       extern char *getenv();
        int nserv = 0;    /* number of nameserver records read from file */
        int haveenv = 0;
        int havesearch = 0;
        int nserv = 0;    /* number of nameserver records read from file */
        int haveenv = 0;
        int havesearch = 0;
index f7880b0..66c4b77 100644 (file)
@@ -6,14 +6,15 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_mkquery.c      6.14 (Berkeley) %G%";
+static char sccsid[] = "@(#)res_mkquery.c      6.15 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #endif /* LIBC_SCCS and not lint */
 
-#include <stdio.h>
 #include <sys/param.h>
 #include <netinet/in.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
 #include <sys/param.h>
 #include <netinet/in.h>
 #include <arpa/nameser.h>
 #include <resolv.h>
+#include <stdio.h>
+#include <string.h>
 
 /*
  * Form all types of queries.
 
 /*
  * Form all types of queries.
@@ -21,11 +22,11 @@ static char sccsid[] = "@(#)res_mkquery.c   6.14 (Berkeley) %G%";
  */
 res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
        int op;                 /* opcode of query */
  */
 res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
        int op;                 /* opcode of query */
-       char *dname;            /* domain name */
+       const char *dname;              /* domain name */
        int class, type;        /* class and type of query */
        int class, type;        /* class and type of query */
-       char *data;             /* resource record data */
+       const char *data;               /* resource record data */
        int datalen;            /* length of data */
        int datalen;            /* length of data */
-       struct rrec *newrr;     /* new rr for modify or append */
+       const struct rrec *newrr;       /* new rr for modify or append */
        char *buf;              /* buffer to put query */
        int buflen;             /* size of buffer */
 {
        char *buf;              /* buffer to put query */
        int buflen;             /* size of buffer */
 {
@@ -33,7 +34,6 @@ res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
        register char *cp;
        register int n;
        char *dnptrs[10], **dpp, **lastdnptr;
        register char *cp;
        register int n;
        char *dnptrs[10], **dpp, **lastdnptr;
-       extern char *index();
 
 #ifdef DEBUG
        if (_res.options & RES_DEBUG)
 
 #ifdef DEBUG
        if (_res.options & RES_DEBUG)
@@ -64,7 +64,8 @@ res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
        case QUERY:
                if ((buflen -= QFIXEDSZ) < 0)
                        return(-1);
        case QUERY:
                if ((buflen -= QFIXEDSZ) < 0)
                        return(-1);
-               if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
+               if ((n = dn_comp((u_char *)dname, (u_char *)cp, buflen,
+                   (u_char **)dnptrs, (u_char **)lastdnptr)) < 0)
                        return (-1);
                cp += n;
                buflen -= n;
                        return (-1);
                cp += n;
                buflen -= n;
@@ -79,7 +80,8 @@ res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
                 * Make an additional record for completion domain.
                 */
                buflen -= RRFIXEDSZ;
                 * Make an additional record for completion domain.
                 */
                buflen -= RRFIXEDSZ;
-               if ((n = dn_comp(data, cp, buflen, dnptrs, lastdnptr)) < 0)
+               if ((n = dn_comp((u_char *)data, (u_char *)cp, buflen,
+                   (u_char **)dnptrs, (u_char **)lastdnptr)) < 0)
                        return (-1);
                cp += n;
                buflen -= n;
                        return (-1);
                cp += n;
                buflen -= n;
index b483b94..837c053 100644 (file)
@@ -6,20 +6,19 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_query.c        5.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)res_query.c        5.9 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/param.h>
-#include <sys/socket.h>
 #include <netinet/in.h>
 #include <netinet/in.h>
-#include <ctype.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
 #include <netdb.h>
 #include <netdb.h>
+#include <resolv.h>
 #include <stdio.h>
 #include <errno.h>
 #include <stdio.h>
 #include <errno.h>
+#include <stdlib.h>
 #include <string.h>
 #include <string.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
 
 #if PACKETSZ > 1024
 #define MAXPACKET      PACKETSZ
 
 #if PACKETSZ > 1024
 #define MAXPACKET      PACKETSZ
@@ -27,7 +26,6 @@ static char sccsid[] = "@(#)res_query.c       5.8 (Berkeley) %G%";
 #define MAXPACKET      1024
 #endif
 
 #define MAXPACKET      1024
 #endif
 
-extern int errno;
 int h_errno;
 
 /*
 int h_errno;
 
 /*
@@ -66,7 +64,7 @@ res_query(name, class, type, answer, anslen)
                h_errno = NO_RECOVERY;
                return (n);
        }
                h_errno = NO_RECOVERY;
                return (n);
        }
-       n = res_send(buf, n, answer, anslen);
+       n = res_send(buf, n, (char *)answer, anslen);
        if (n < 0) {
 #ifdef DEBUG
                if (_res.options & RES_DEBUG)
        if (n < 0) {
 #ifdef DEBUG
                if (_res.options & RES_DEBUG)
index 58fd4b6..2118794 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_send.c 6.26 (Berkeley) %G%";
+static char sccsid[] = "@(#)res_send.c 6.27 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 /*
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -18,16 +18,15 @@ static char sccsid[] = "@(#)res_send.c      6.26 (Berkeley) %G%";
 #include <sys/socket.h>
 #include <sys/uio.h>
 #include <netinet/in.h>
 #include <sys/socket.h>
 #include <sys/uio.h>
 #include <netinet/in.h>
+#include <arpa/nameser.h>
 #include <stdio.h>
 #include <errno.h>
 #include <stdio.h>
 #include <errno.h>
-#include <arpa/nameser.h>
 #include <resolv.h>
 #include <resolv.h>
-
-extern int errno;
+#include <unistd.h>
+#include <string.h>
 
 static int s = -1;     /* socket used for communications */
 static struct sockaddr no_addr;
 
 static int s = -1;     /* socket used for communications */
 static struct sockaddr no_addr;
-  
 
 #ifndef FD_SET
 #define        NFDBITS         32
 
 #ifndef FD_SET
 #define        NFDBITS         32
@@ -39,7 +38,7 @@ static struct sockaddr no_addr;
 #endif
 
 res_send(buf, buflen, answer, anslen)
 #endif
 
 res_send(buf, buflen, answer, anslen)
-       char *buf;
+       const char *buf;
        int buflen;
        char *answer;
        int anslen;
        int buflen;
        char *answer;
        int anslen;
@@ -99,8 +98,9 @@ res_send(buf, buflen, answer, anslen)
 #endif DEBUG
                                        continue;
                                }
 #endif DEBUG
                                        continue;
                                }
-                               if (connect(s, &(_res.nsaddr_list[ns]),
-                                  sizeof(struct sockaddr)) < 0) {
+                               if (connect(s,
+                                   (struct sockaddr *)&(_res.nsaddr_list[ns]),
+                                   sizeof(struct sockaddr)) < 0) {
                                        terrno = errno;
 #ifdef DEBUG
                                        if (_res.options & RES_DEBUG)
                                        terrno = errno;
 #ifdef DEBUG
                                        if (_res.options & RES_DEBUG)
@@ -117,7 +117,7 @@ res_send(buf, buflen, answer, anslen)
                        len = htons((u_short)buflen);
                        iov[0].iov_base = (caddr_t)&len;
                        iov[0].iov_len = sizeof(len);
                        len = htons((u_short)buflen);
                        iov[0].iov_base = (caddr_t)&len;
                        iov[0].iov_len = sizeof(len);
-                       iov[1].iov_base = buf;
+                       iov[1].iov_base = (char *)buf;
                        iov[1].iov_len = buflen;
                        if (writev(s, iov, 2) != sizeof(len) + buflen) {
                                terrno = errno;
                        iov[1].iov_len = buflen;
                        if (writev(s, iov, 2) != sizeof(len) + buflen) {
                                terrno = errno;
@@ -242,7 +242,7 @@ res_send(buf, buflen, answer, anslen)
                                 * from another server.
                                 */
                                if (connected == 0) {
                                 * from another server.
                                 */
                                if (connected == 0) {
-                                       if (connect(s, &_res.nsaddr_list[ns],
+                       if (connect(s, (struct sockaddr *)&_res.nsaddr_list[ns],
                                            sizeof(struct sockaddr)) < 0) {
 #ifdef DEBUG
                                                if (_res.options & RES_DEBUG)
                                            sizeof(struct sockaddr)) < 0) {
 #ifdef DEBUG
                                                if (_res.options & RES_DEBUG)
@@ -271,7 +271,7 @@ res_send(buf, buflen, answer, anslen)
                                }
 #endif BSD
                                if (sendto(s, buf, buflen, 0,
                                }
 #endif BSD
                                if (sendto(s, buf, buflen, 0,
-                                   &_res.nsaddr_list[ns],
+                                   (struct sockaddr *)&_res.nsaddr_list[ns],
                                    sizeof(struct sockaddr)) != buflen) {
 #ifdef DEBUG
                                        if (_res.options & RES_DEBUG)
                                    sizeof(struct sockaddr)) != buflen) {
 #ifdef DEBUG
                                        if (_res.options & RES_DEBUG)
index 7431a6b..e9ce8d0 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)send.c     5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)send.c     5.3 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -15,7 +15,7 @@ static char sccsid[] = "@(#)send.c    5.2 (Berkeley) %G%";
 
 send(s, msg, len, flags)
        int s, len, flags;
 
 send(s, msg, len, flags)
        int s, len, flags;
-       char *msg;
+       const void *msg;
 {
        return(sendto(s, msg, len, flags, (struct sockaddr *)NULL, 0));
 }
 {
        return(sendto(s, msg, len, flags, (struct sockaddr *)NULL, 0));
 }
index f56edcd..09158b1 100644 (file)
@@ -6,20 +6,23 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sethostent.c       6.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)sethostent.c       6.8 (Berkeley) %G%";
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
-#include <arpa/nameser.h>
 #include <netinet/in.h>
 #include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <netdb.h>
 #include <resolv.h>
 
 #include <resolv.h>
 
+void
 sethostent(stayopen)
 {
        if (stayopen)
                _res.options |= RES_STAYOPEN | RES_USEVC;
 }
 
 sethostent(stayopen)
 {
        if (stayopen)
                _res.options |= RES_STAYOPEN | RES_USEVC;
 }
 
+void
 endhostent()
 {
        _res.options &= ~(RES_STAYOPEN | RES_USEVC);
 endhostent()
 {
        _res.options &= ~(RES_STAYOPEN | RES_USEVC);