Remove some unnecessary casts.
authorSascha Wildner <saw@online.de>
Sun, 14 Dec 2008 17:56:01 +0000 (18:56 +0100)
committerSascha Wildner <saw@online.de>
Sun, 14 Dec 2008 17:56:16 +0000 (18:56 +0100)
34 files changed:
bin/hostname/hostname.c
games/hunt/hunt/list.c
lib/libatm/ip_addr.c
lib/libbluetooth/bluetooth.3
lib/libutil/realhostname.c
libexec/talkd/process.c
sbin/ip6fw/ip6fw.c
sbin/ipfw/ipfw2.c
sbin/mount_nfs/mount_nfs.c
sbin/mountd/mountd.c
sbin/ping/ping.c
sbin/route/route.c
sbin/routed/rtquery/rtquery.c
usr.bin/netstat/inet.c
usr.bin/netstat/inet6.c
usr.bin/netstat/route.c
usr.bin/rpcinfo/rpcinfo.c
usr.bin/rup/rup.c
usr.bin/rusers/rusers.c
usr.bin/systat/netcmds.c
usr.bin/systat/netstat.c
usr.bin/talk/io.c
usr.bin/w/w.c
usr.bin/ypwhich/ypwhich.c
usr.sbin/arp/arp.c
usr.sbin/bootparamd/bootparamd/bootparamd.c
usr.sbin/bootparamd/callbootd/callbootd.c
usr.sbin/btconfig/btconfig.c
usr.sbin/i4b/isdnd/monitor.c
usr.sbin/mrouted/mapper.c
usr.sbin/mrouted/mrinfo.c
usr.sbin/mrouted/mtrace.c
usr.sbin/rpc.lockd/procs.c
usr.sbin/traceroute/traceroute.c

index 217574b..db8dd09 100644 (file)
@@ -220,7 +220,7 @@ main(int argc, char **argv)
                                        if (iflag & HST_IF_V6) {
                                                if (sai->sin_family == AF_INET6) {
                                                        sai6 = (struct sockaddr_in6 *)info.rti_info[RTAX_IFA];
-                                                       hst = gethostbyaddr((const char*)&sai6->sin6_addr,
+                                                       hst = gethostbyaddr(&sai6->sin6_addr,
                                                                        sizeof(sai6->sin6_addr),AF_INET6);
 
                                                        if (h_errno == NETDB_SUCCESS) {
@@ -231,7 +231,7 @@ main(int argc, char **argv)
                                        } else {
                                                if ((sai->sin_family == AF_INET)) {
 
-                                                       hst = gethostbyaddr((const char*)&sai->sin_addr,
+                                                       hst = gethostbyaddr(&sai->sin_addr,
                                                                        sizeof(sai->sin_addr),AF_INET);
 
                                                        if (h_errno == NETDB_SUCCESS) {
@@ -275,9 +275,9 @@ main(int argc, char **argv)
                }
                
                if (flag6 == 1) 
-                       hst = gethostbyaddr((const char*)&ia6, sizeof(ia6), AF_INET6);
+                       hst = gethostbyaddr(&ia6, sizeof(ia6), AF_INET6);
                else
-                       hst = gethostbyaddr((const char*)&ia, sizeof(ia), AF_INET);
+                       hst = gethostbyaddr(&ia, sizeof(ia), AF_INET);
                if (!hst) {
                        if (h_errno == HOST_NOT_FOUND) 
                                errx(1,"host not found\n");
index ba2517d..cc1fa24 100644 (file)
@@ -144,8 +144,8 @@ driver_name(struct driver *driver)
 
        if (driver->addr.sa_family == AF_INET) {
                sin = (struct sockaddr_in *)&driver->addr;
-               hp = gethostbyaddr((char *)&sin->sin_addr, 
-                   sizeof sin->sin_addr, AF_INET);
+               hp = gethostbyaddr(&sin->sin_addr, sizeof sin->sin_addr,
+                   AF_INET);
                if (hp != NULL)
                        name = hp->h_name;
                else {
index 0fbc411..3acdd1f 100644 (file)
@@ -145,7 +145,7 @@ format_ip_addr(struct in_addr *addr)
        /*
         * Look up name in DNS
         */
-       ip_host = gethostbyaddr((char *)addr, sizeof(addr), AF_INET);
+       ip_host = gethostbyaddr(addr, sizeof(addr), AF_INET);
        if (ip_host && ip_host->h_name &&
                        strlen(ip_host->h_name)) {
                /*
index 6adc7d1..e9a88fe 100644 (file)
@@ -222,8 +222,8 @@ struct hostent *hp;
 if (!bt_aton(bdstr, \*[Am]bd))
        errx(1, "can't parse BD_ADDR %s", bdstr);
 
-if ((hp = bt_gethostbyaddr((const char *)\*[Am]bd,
-    sizeof(bd), AF_BLUETOOTH)) == NULL)
+if ((hp = bt_gethostbyaddr(\*[Am]bd, sizeof(bd),
+    AF_BLUETOOTH)) == NULL)
        errx(1, "no name associated with %s", bdstr);
 
 printf("name associated with %s is %s\en", bdstr, hp-\*[Gt]h_name);
index 83cf2a5..c86ffb5 100644 (file)
@@ -58,7 +58,7 @@ realhostname(char *host, size_t hsize, const struct in_addr *ip)
        struct hostent *hp;
 
        result = HOSTNAME_INVALIDADDR;
-       hp = gethostbyaddr((char *)ip, sizeof(*ip), AF_INET);
+       hp = gethostbyaddr(ip, sizeof(*ip), AF_INET);
 
        if (hp != NULL) {
                strlcpy(trimmed, hp->h_name, sizeof(trimmed));
index ca57d11..88ceb46 100644 (file)
@@ -162,7 +162,7 @@ do_announce(mp, rp)
                return;
        }
 #define        satosin(sa)     ((struct sockaddr_in *)(sa))
-       hp = gethostbyaddr((char *)&satosin(&mp->ctl_addr)->sin_addr,
+       hp = gethostbyaddr(&satosin(&mp->ctl_addr)->sin_addr,
                sizeof (struct in_addr), AF_INET);
        if (hp == (struct hostent *)0) {
                rp->answer = MACHINE_UNKNOWN;
index b344302..76a870f 100644 (file)
@@ -285,7 +285,7 @@ show_ip6fw(struct ip6_fw *chain)
 
        mb=mask_bits((u_char *)&chain->fw_smsk,sizeof(chain->fw_smsk));
        if (mb==128 && do_resolv) {
-               he=gethostbyaddr((char *)&(chain->fw_src),sizeof(chain->fw_src),AF_INET6);
+               he=gethostbyaddr(&(chain->fw_src),sizeof(chain->fw_src),AF_INET6);
                if (he==NULL) {
                        printf(inet_ntop(AF_INET6,&chain->fw_src,ntop_buf,sizeof(ntop_buf)));
                } else
@@ -317,7 +317,7 @@ show_ip6fw(struct ip6_fw *chain)
 
        mb=mask_bits((u_char *)&chain->fw_dmsk,sizeof(chain->fw_dmsk));
        if (mb==128 && do_resolv) {
-               he=gethostbyaddr((char *)&(chain->fw_dst),sizeof(chain->fw_dst),AF_INET6);
+               he=gethostbyaddr(&(chain->fw_dst),sizeof(chain->fw_dst),AF_INET6);
                if (he==NULL) {
                        printf(inet_ntop(AF_INET6,&chain->fw_dst,ntop_buf,sizeof(ntop_buf)));
                } else
index 570d3ec..f2188d8 100644 (file)
@@ -677,8 +677,8 @@ print_ip(ipfw_insn_ip *cmd, char *s)
        else
                mb = contigmask((u_char *)&(cmd->mask.s_addr), 32);
        if (mb == 32 && do_resolv)
-               he = gethostbyaddr((char *)&(cmd->addr.s_addr),
-                   sizeof(u_long), AF_INET);
+               he = gethostbyaddr(&(cmd->addr.s_addr), sizeof(u_long),
+                   AF_INET);
        if (he != NULL)         /* resolved to name */
                printf("%s", he->h_name);
        else if (mb == 0)       /* any */
index 7579a9a..a2714b0 100644 (file)
@@ -643,7 +643,7 @@ getnfsargs(char *spec, struct nfs_args *nfsargsp)
                }
 #ifdef NFSKERB
                if (haserror == 0 && (nfsargsp->flags & NFSMNT_KERB)) {
-                       if ((hp = gethostbyaddr((char *)&saddr.sin_addr.s_addr,
+                       if ((hp = gethostbyaddr(&saddr.sin_addr.s_addr,
                            sizeof (u_long), AF_INET)) == NULL) {
                                warnx("can't reverse resolve net address");
                                opflags |= DIDWARN;
index 33ec51c..fc91ac8 100644 (file)
@@ -433,8 +433,8 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
                        if (!svc_sendreply(transp, xdr_fhs, (caddr_t)&fhr))
                                syslog(LOG_ERR, "can't send reply");
                        if (hp == NULL)
-                               hp = gethostbyaddr((caddr_t)&saddr,
-                                   sizeof(saddr), AF_INET);
+                               hp = gethostbyaddr(&saddr, sizeof(saddr),
+                                   AF_INET);
                        if (hp)
                                add_mlist(hp->h_name, dirpath);
                        else
@@ -486,7 +486,7 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
                }
                if (!svc_sendreply(transp, xdr_void, (caddr_t)NULL))
                        syslog(LOG_ERR, "can't send reply");
-               hp = gethostbyaddr((caddr_t)&saddr, sizeof(saddr), AF_INET);
+               hp = gethostbyaddr(&saddr, sizeof(saddr), AF_INET);
                if (hp)
                        del_mlist(hp->h_name, dirpath);
                del_mlist(inet_ntoa(saddrin), dirpath);
@@ -505,7 +505,7 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
                }
                if (!svc_sendreply(transp, xdr_void, (caddr_t)NULL))
                        syslog(LOG_ERR, "can't send reply");
-               hp = gethostbyaddr((caddr_t)&saddr, sizeof(saddr), AF_INET);
+               hp = gethostbyaddr(&saddr, sizeof(saddr), AF_INET);
                if (hp)
                        del_mlist(hp->h_name, (char *)NULL);
                del_mlist(inet_ntoa(saddrin), (char *)NULL);
@@ -1408,7 +1408,7 @@ get_host(char *cp, struct grouplist *grp, struct grouplist *tgrp)
                                syslog(LOG_ERR, "inet_addr failed for %s", cp);
                                return (1);
                        }
-                       if ((hp = gethostbyaddr((caddr_t)&saddr, sizeof (saddr),
+                       if ((hp = gethostbyaddr(&saddr, sizeof (saddr),
                                AF_INET)) == NULL) {
                                hp = &t_host;
                                hp->h_name = cp;
index 80ffa7d..5d2e9f7 100644 (file)
@@ -1592,7 +1592,7 @@ pr_addr(struct in_addr ina)
        static char buf[16 + 3 + MAXHOSTNAMELEN];
 
        if ((options & F_NUMERIC) ||
-           !(hp = gethostbyaddr((char *)&ina, 4, AF_INET)))
+           !(hp = gethostbyaddr(&ina, 4, AF_INET)))
                return inet_ntoa(ina);
        else
                snprintf(buf, sizeof(buf), "%s (%s)", hp->h_name,
index b282949..232f671 100644 (file)
@@ -368,7 +368,7 @@ routename(struct sockaddr *sa)
                if (in.s_addr == INADDR_ANY || sa->sa_len < 4)
                        cp = "default";
                if (cp == NULL && !nflag) {
-                       hp = gethostbyaddr((char *)&in, sizeof(struct in_addr),
+                       hp = gethostbyaddr(&in, sizeof(struct in_addr),
                                AF_INET);
                        if (hp != NULL) {
                                char *cptr;
index 1225752..e12c20a 100644 (file)
@@ -610,8 +610,8 @@ rip_input(struct sockaddr_in *from,
        if (nflag) {
                printf("%s:", inet_ntoa(from->sin_addr));
        } else {
-               hp = gethostbyaddr((char*)&from->sin_addr,
-                                  sizeof(struct in_addr), AF_INET);
+               hp = gethostbyaddr(&from->sin_addr, sizeof(struct in_addr),
+                                  AF_INET);
                if (hp == 0) {
                        printf("%s:",
                               inet_ntoa(from->sin_addr));
@@ -692,8 +692,7 @@ rip_input(struct sockaddr_in *from,
                                if (name[0] == '\0'
                                    && ((in.s_addr & ~mask) != 0
                                        || mask == 0xffffffff)) {
-                                       hp = gethostbyaddr((char*)&in,
-                                                          sizeof(in),
+                                       hp = gethostbyaddr(&in, sizeof(in),
                                                           AF_INET);
                                        if (hp != 0)
                                                name = hp->h_name;
@@ -760,8 +759,7 @@ rip_input(struct sockaddr_in *from,
                        if (nflag)
                                hp = 0;
                        else
-                               hp = gethostbyaddr((char*)&in, sizeof(in),
-                                                  AF_INET);
+                               hp = gethostbyaddr(&in, sizeof(in), AF_INET);
                        printf(" nhop=%-15s%s",
                               (hp != 0) ? hp->h_name : inet_ntoa(in),
                               (IMSG.rip_vers == RIPv1) ? " ?" : "");
index f22548a..53dab5d 100644 (file)
@@ -930,7 +930,7 @@ inetname(struct in_addr *inp)
                                cp = np->n_name;
                }
                if (cp == 0) {
-                       hp = gethostbyaddr((char *)inp, sizeof (*inp), AF_INET);
+                       hp = gethostbyaddr(inp, sizeof (*inp), AF_INET);
                        if (hp) {
                                cp = hp->h_name;
                                trimdomain(cp, strlen(cp));
index 2809057..9ac29a9 100644 (file)
@@ -1087,7 +1087,7 @@ inet6name(struct in6_addr *in6p)
        }
        cp = 0;
        if (!numeric_addr && !IN6_IS_ADDR_UNSPECIFIED(in6p)) {
-               hp = gethostbyaddr((char *)in6p, sizeof(*in6p), AF_INET6);
+               hp = gethostbyaddr(in6p, sizeof(*in6p), AF_INET6);
                if (hp) {
                        if ((cp = strchr(hp->h_name, '.')) &&
                            !strcmp(cp + 1, domain))
index 3d4fc49..3c04ce8 100644 (file)
@@ -821,8 +821,7 @@ routename(u_long in)
 
        cp = 0;
        if (!numeric_addr) {
-               hp = gethostbyaddr((char *)&in, sizeof (struct in_addr),
-                       AF_INET);
+               hp = gethostbyaddr(&in, sizeof (struct in_addr), AF_INET);
                if (hp) {
                        cp = hp->h_name;
                        trimdomain(cp, strlen(cp));
index 98f0c83..e3a31f7 100644 (file)
@@ -551,8 +551,7 @@ reply_proc(res, who)
 {
        register struct hostent *hp;
 
-       hp = gethostbyaddr((char *) &who->sin_addr, sizeof who->sin_addr,
-           AF_INET);
+       hp = gethostbyaddr(&who->sin_addr, sizeof who->sin_addr, AF_INET);
        printf("%s %s\n", inet_ntoa(who->sin_addr),
            (hp == NULL) ? "(unknown)" : hp->h_name);
        return(FALSE);
index e0396da..9d310ad 100644 (file)
@@ -100,8 +100,8 @@ rstat_reply(char *replyp, struct sockaddr_in *raddrp)
        if (search_host(raddrp->sin_addr))
                return(0);
 
-       hp = gethostbyaddr((char *)&raddrp->sin_addr.s_addr,
-                          sizeof(struct in_addr), AF_INET);
+       hp = gethostbyaddr(&raddrp->sin_addr.s_addr, sizeof(struct in_addr),
+                          AF_INET);
        if (hp)
                host = hp->h_name;
        else
index 05e7fe9..07ea2bb 100644 (file)
@@ -102,8 +102,8 @@ rusers_reply(char *replyp, struct sockaddr_in *raddrp)
        if (!allopt && up->utmpidlearr_len == 0)
                return (0);
 
-       hp = gethostbyaddr((char *)&raddrp->sin_addr.s_addr,
-           sizeof(struct in_addr), AF_INET);
+       hp = gethostbyaddr(&raddrp->sin_addr.s_addr, sizeof(struct in_addr),
+           AF_INET);
        if (hp != NULL)
                host = hp->h_name;
        else
index a0d07db..40a2ef3 100644 (file)
@@ -298,7 +298,7 @@ showhosts(void)
        struct hostent *hp;
 
        for (p = hosts; p < hosts+nhosts; p++) {
-               hp = gethostbyaddr((char *)&p->addr, sizeof (p->addr), AF_INET);
+               hp = gethostbyaddr(&p->addr, sizeof (p->addr), AF_INET);
                if (!p->onoff)
                        addch('!');
                printw("%s ", hp ? hp->h_name : (char *)inet_ntoa(p->addr));
index 0a03cf4..4c1c63f 100644 (file)
@@ -437,7 +437,7 @@ inetname(struct in_addr in)
                                cp = np->n_name;
                }
                if (cp == 0) {
-                       hp = gethostbyaddr((char *)&in, sizeof (in), AF_INET);
+                       hp = gethostbyaddr(&in, sizeof (in), AF_INET);
                        if (hp)
                                cp = hp->h_name;
                }
index 36a5e88..d8d7b8e 100644 (file)
@@ -64,7 +64,7 @@ talk(void)
        struct timeval wait;
 
        his_machine_name = NULL;
-       hp = gethostbyaddr((const char *)&his_machine_addr.s_addr,
+       hp = gethostbyaddr(&his_machine_addr.s_addr,
            sizeof(his_machine_addr.s_addr), AF_INET);
        if (hp != NULL) {
                hp2 = gethostbyname(hp->h_name);
index 705696a..54b9dad 100644 (file)
@@ -357,7 +357,7 @@ main(int argc, char **argv)
                if ((x = strchr(p, ':')) != NULL)
                        *x++ = '\0';
                if (!nflag && isdigit(*p) && (l = inet_addr(p)) != -1 &&
-                   (hp = gethostbyaddr((char *)&l, sizeof(l), AF_INET))) {
+                   (hp = gethostbyaddr(&l, sizeof(l), AF_INET))) {
                        if (domain[0] != '\0') {
                                p = hp->h_name;
                                p += strlen(hp->h_name);
index c3d2c2b..8cda2eb 100644 (file)
@@ -122,7 +122,7 @@ bind_host(char *dom, struct sockaddr_in *sin)
 
        ss_addr = *(struct in_addr *)ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr;
        /*printf("%08x\n", ss_addr);*/
-       hent = gethostbyaddr((char *)&ss_addr, sizeof(ss_addr), AF_INET);
+       hent = gethostbyaddr(&ss_addr, sizeof(ss_addr), AF_INET);
        if (hent)
                printf("%s\n", hent->h_name);
        else
index 0a4b774..f92c3fb 100644 (file)
@@ -510,8 +510,8 @@ print_entry(struct sockaddr_dl *sdl,
        char ifname[IF_NAMESIZE];
 
        if (nflag == 0)
-               hp = gethostbyaddr((caddr_t)&(addr->sin_addr),
-                   sizeof(addr->sin_addr), AF_INET);
+               hp = gethostbyaddr(&(addr->sin_addr), sizeof(addr->sin_addr),
+                   AF_INET);
        else
                hp = 0;
        if (hp)
index 8819d14..ca1bb25 100644 (file)
@@ -60,7 +60,7 @@ bootparamproc_whoami_1(bp_whoami_arg *whoami)
 
   bcopy((char *)&whoami->client_address.bp_address_u.ip_addr, (char *)&haddr,
        sizeof(haddr));
-  he = gethostbyaddr((char *)&haddr,sizeof(haddr),AF_INET);
+  he = gethostbyaddr(&haddr,sizeof(haddr),AF_INET);
   if ( ! he ) goto failed;
 
   if (debug) warnx("this is host %s", he->h_name);
index 0d17885..b33fe96 100644 (file)
@@ -41,7 +41,7 @@ eachres_whoami(bp_whoami_res *resultp, struct sockaddr_in *raddr)
 {
   struct hostent *he;
 
-  he = gethostbyaddr((char *)&raddr->sin_addr.s_addr,4,AF_INET);
+  he = gethostbyaddr(&raddr->sin_addr.s_addr,4,AF_INET);
   printf("%s answered:\n", he ? he->h_name : inet_ntoa(raddr->sin_addr));
   printwhoami(resultp);
   printf("\n");
@@ -52,7 +52,7 @@ eachres_getfile(bp_getfile_res *resultp, struct sockaddr_in *raddr)
 {
   struct hostent *he;
 
-  he = gethostbyaddr((char *)&raddr->sin_addr.s_addr,4,AF_INET);
+  he = gethostbyaddr(&raddr->sin_addr.s_addr,4,AF_INET);
   printf("%s answered:\n", he ? he->h_name : inet_ntoa(raddr->sin_addr));
   printgetfile(resultp);
   printf("\n");
index 8dc4b64..deeb5b2 100644 (file)
@@ -994,7 +994,7 @@ print_result(int num, struct result *r, int rssi)
                        num,
                        bt_ntoa(&r->bdaddr, NULL));
 
-       hp = bt_gethostbyaddr((const char *)&r->bdaddr, sizeof(bdaddr_t), AF_BLUETOOTH);
+       hp = bt_gethostbyaddr(&r->bdaddr, sizeof(bdaddr_t), AF_BLUETOOTH);
 
 #if 0
        if (hp != NULL)
index 9acdf53..cd25c4a 100644 (file)
@@ -576,7 +576,7 @@ monitor_handle_connect(int sockfd, int is_local)
                s = sizeof ia;
                fd = accept(sockfd, (struct sockaddr *)&ia, &s);
 
-               hp = gethostbyaddr((char *)&ia.sin_addr, 4, AF_INET);
+               hp = gethostbyaddr(&ia.sin_addr, 4, AF_INET);
 
                if(hp == NULL)
                        snprintf(source, sizeof source, "%s (%s)", inet_ntoa(ia.sin_addr), inet_ntoa(ia.sin_addr));
index 4e4f4d5..ad34df5 100644 (file)
@@ -601,7 +601,7 @@ inet_name(u_int32 addr)
 {
     struct hostent *e;
 
-    e = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET);
+    e = gethostbyaddr(&addr, sizeof(addr), AF_INET);
 
     return e ? e->h_name : 0;
 }
index a6c11d2..8e036d3 100644 (file)
@@ -104,7 +104,7 @@ inet_name(u_int32 addr)
                return "local";
 
        if (nflag ||
-           (e = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET)) == NULL) {
+           (e = gethostbyaddr(&addr, sizeof(addr), AF_INET)) == NULL) {
                in.s_addr = addr;
                return (inet_ntoa(in));
        }
index b5e91a6..7e4b955 100644 (file)
@@ -734,7 +734,7 @@ inet_name(u_int32 addr)
 {
     struct hostent *e;
 
-    e = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET);
+    e = gethostbyaddr(&addr, sizeof(addr), AF_INET);
 
     return e ? e->h_name : "?";
 }
index 7245445..dc3e5f2 100644 (file)
@@ -70,7 +70,7 @@ log_from_addr(char *fun_name, struct svc_req *req)
   char hostname_buf[40];
 
   addr = svc_getcaller(req->rq_xprt);
-  host = gethostbyaddr((char *)&(addr->sin_addr), addr->sin_len, AF_INET);
+  host = gethostbyaddr(&(addr->sin_addr), addr->sin_len, AF_INET);
   if (host)
   {
     strncpy(hostname_buf, host->h_name, sizeof(hostname_buf));
index 548e642..6694471 100644 (file)
@@ -1160,7 +1160,7 @@ inetname(struct in_addr in)
                }
        }
        if (!nflag && in.s_addr != INADDR_ANY) {
-               hp = gethostbyaddr((char *)&in, sizeof(in), AF_INET);
+               hp = gethostbyaddr(&in, sizeof(in), AF_INET);
                if (hp != NULL) {
                        if ((cp = strchr(hp->h_name, '.')) != NULL &&
                            strcmp(cp + 1, domain) == 0)