From ce54a1d058edea29bf0555ec44642ec1c15ba2f0 Mon Sep 17 00:00:00 2001 From: jhay Date: Thu, 26 Jun 1997 19:36:03 +0000 Subject: 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 --- sys/netipx/ipx.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 6 deletions(-) (limited to 'sys/netipx/ipx.c') 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 -#include #include -#include +#include #include #include -#include -#include #include -#include #include #include @@ -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); +} -- cgit v1.1