diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-06-24 03:15:24 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-06-24 03:15:24 +0000 |
commit | be3de05a7c78f939275f24624ac6d6895cdf2b63 (patch) | |
tree | 8cc3fe4f41b947ca36a4ade69800851ad260e6df /sbin/route | |
parent | f6eb3918415010b402fae13bef7e03a874476185 (diff) |
Fix "route show" on alpha. Some parts from Theo.
Diffstat (limited to 'sbin/route')
-rw-r--r-- | sbin/route/ccitt_addr.c | 5 | ||||
-rw-r--r-- | sbin/route/route.c | 22 | ||||
-rw-r--r-- | sbin/route/show.c | 2 |
3 files changed, 16 insertions, 13 deletions
diff --git a/sbin/route/ccitt_addr.c b/sbin/route/ccitt_addr.c index 4d3afa8fe3e..e1c6c534a5e 100644 --- a/sbin/route/ccitt_addr.c +++ b/sbin/route/ccitt_addr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccitt_addr.c,v 1.2 1996/06/23 14:32:21 deraadt Exp $ */ +/* $OpenBSD: ccitt_addr.c,v 1.3 1997/06/24 03:15:22 millert Exp $ */ /* $NetBSD: ccitt_addr.c,v 1.8 1995/04/23 10:33:41 cgd Exp $ */ /* @@ -53,12 +53,15 @@ * Copyright (c) 1984 */ +#include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netccitt/x25.h> static char *copychar (); +int ccitt_addr (addr, xp) char *addr; register struct sockaddr_x25 *xp; diff --git a/sbin/route/route.c b/sbin/route/route.c index 526c8a113fd..d9ec3f159f8 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.19 1997/06/04 10:36:16 deraadt Exp $ */ +/* $OpenBSD: route.c,v 1.20 1997/06/24 03:15:23 millert Exp $ */ /* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)route.c 8.3 (Berkeley) 3/19/94"; #else -static char rcsid[] = "$OpenBSD: route.c,v 1.19 1997/06/04 10:36:16 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: route.c,v 1.20 1997/06/24 03:15:23 millert Exp $"; #endif #endif /* not lint */ @@ -133,7 +133,7 @@ quit(s) } #define ROUNDUP(a) \ - ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) + ((a) > 0 ? (1 + (((a) - 1) | (sizeof(in_addr_t) - 1))) : sizeof(in_addr_t)) #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) int @@ -368,8 +368,8 @@ routename(sa) if (in.s_addr == INADDR_ANY || sa->sa_len < 4) cp = "default"; if (!cp && !nflag) { - if ((hp = gethostbyaddr((char *)&in, - sizeof (struct in_addr), AF_INET))) { + if ((hp = gethostbyaddr((char *)&in.s_addr, + sizeof (in.s_addr), AF_INET)) != NULL) { if ((cp = strchr(hp->h_name, '.')) && !strcmp(cp + 1, domain)) *cp = 0; @@ -414,16 +414,16 @@ netname(sa) char *cp = NULL; static char line[MAXHOSTNAMELEN]; struct netent *np = 0; - long net, mask; - int subnetshift; + in_addr_t net; + int mask, subnetshift; char *ns_print(); char *ipx_print(); switch (sa->sa_family) { case AF_INET: - { struct in_addr in; - in = ((struct sockaddr_in *)sa)->sin_addr; + { + struct in_addr in = ((struct sockaddr_in *)sa)->sin_addr; in.s_addr = ntohl(in.s_addr); if (in.s_addr == 0) @@ -1004,7 +1004,7 @@ ns_print(sns) *cport = '\0'; (void) snprintf(mybuf, sizeof mybuf, "0x%x.%s%s", - (u_int32_t)ntohl(net.long_e), host, cport); + ntohl(net.long_e), host, cport); return (mybuf); } @@ -1052,7 +1052,7 @@ ipx_print(sipx) *cport = 0; (void) snprintf(mybuf, sizeof mybuf, "%XH.%s%s", - (u_int32_t)ntohl(net.long_e), host, cport); + ntohl(net.long_e), host, cport); return (mybuf); } diff --git a/sbin/route/show.c b/sbin/route/show.c index 1e16d394481..bbbd0589d1c 100644 --- a/sbin/route/show.c +++ b/sbin/route/show.c @@ -193,7 +193,7 @@ p_rtentry(rtm) else { p_sockaddr(sa, rtm->rtm_flags, 16); if (sa->sa_len == 0) - sa->sa_len = sizeof(long); + sa->sa_len = sizeof(in_addr_t); sa = (struct sockaddr *)(sa->sa_len + (char *)sa); p_sockaddr(sa, 0, 18); } |