diff options
author | jhay <jhay@FreeBSD.org> | 1997-06-26 19:36:03 +0000 |
---|---|---|
committer | jhay <jhay@FreeBSD.org> | 1997-06-26 19:36:03 +0000 |
commit | ce54a1d058edea29bf0555ec44642ec1c15ba2f0 (patch) | |
tree | 45e4616a1621a9b02dc517b46c44a020b5995891 /sys/netipx/ipx.c | |
parent | ae52a72f071aa207805a5e3bff9236c3b496be3a (diff) | |
download | FreeBSD-src-ce54a1d058edea29bf0555ec44642ec1c15ba2f0.zip FreeBSD-src-ce54a1d058edea29bf0555ec44642ec1c15ba2f0.tar.gz |
Removed the #ifdef IPXERRORMSGS'ed code. Fix a lot of style errors that I
introduced with the previous commit.
Style fixes Submitted by: Bruce Evans <bde@FreeBSD.ORG>
Diffstat (limited to 'sys/netipx/ipx.c')
-rw-r--r-- | sys/netipx/ipx.c | 69 |
1 files changed, 63 insertions, 6 deletions
diff --git a/sys/netipx/ipx.c b/sys/netipx/ipx.c index 8f0a3ec..9d95fc6 100644 --- a/sys/netipx/ipx.c +++ b/sys/netipx/ipx.c @@ -33,19 +33,15 @@ * * @(#)ipx.c * - * $Id: ipx.c,v 1.9 1997/05/01 06:21:27 jhay Exp $ + * $Id: ipx.c,v 1.10 1997/05/10 09:58:48 jhay Exp $ */ #include <sys/param.h> -#include <sys/queue.h> #include <sys/systm.h> -#include <sys/mbuf.h> +#include <sys/malloc.h> #include <sys/sockio.h> #include <sys/proc.h> -#include <sys/protosw.h> -#include <sys/errno.h> #include <sys/socket.h> -#include <sys/socketvar.h> #include <net/if.h> #include <net/route.h> @@ -333,3 +329,64 @@ ipx_iaonnetof(dst) } return (ia_maybe); } + + +void +ipx_printhost(addr) +register struct ipx_addr *addr; +{ + u_short port; + struct ipx_addr work = *addr; + register char *p; register u_char *q; + register char *net = "", *host = ""; + char cport[10], chost[15], cnet[15]; + + port = ntohs(work.x_port); + + if (ipx_nullnet(work) && ipx_nullhost(work)) { + + if (port) + printf("*.%x", port); + else + printf("*.*"); + + return; + } + + if (ipx_wildnet(work)) + net = "any"; + else if (ipx_nullnet(work)) + net = "*"; + else { + q = work.x_net.c_net; + sprintf(cnet, "%x%x%x%x", + q[0], q[1], q[2], q[3]); + for (p = cnet; *p == '0' && p < cnet + 8; p++) + continue; + net = p; + } + + if (ipx_wildhost(work)) + host = "any"; + else if (ipx_nullhost(work)) + host = "*"; + else { + q = work.x_host.c_host; + sprintf(chost, "%x%x%x%x%x%x", + q[0], q[1], q[2], q[3], q[4], q[5]); + for (p = chost; *p == '0' && p < chost + 12; p++) + continue; + host = p; + } + + if (port) { + if (strcmp(host, "*") == 0) { + host = ""; + sprintf(cport, "%x", port); + } else + sprintf(cport, ".%x", port); + } else + *cport = 0; + + printf("%s.%s%s", net, host, cport); +} |