-#ifndef __APPLE__
-char *
-ipx_print(struct sockaddr *sa)
-{
- u_short port;
- struct servent *sp = 0;
- char *net = "", *host = "";
- register char *p;
- register u_char *q;
- struct ipx_addr work = ((struct sockaddr_ipx *)sa)->sipx_addr;
- static char mybuf[50];
- char cport[10], chost[15], cnet[15];
-
- port = ntohs(work.x_port);
-
- if (ipx_nullnet(work) && ipx_nullhost(work)) {
-
- if (port) {
- if (sp)
- sprintf(mybuf, "*.%s", sp->s_name);
- else
- sprintf(mybuf, "*.%x", port);
- } else
- sprintf(mybuf, "*.*");
-
- return (mybuf);
- }
-
- if (ipx_wildnet(work))
- net = "any";
- else if (ipx_nullnet(work))
- net = "*";
- else {
- q = work.x_net.c_net;
- sprintf(cnet, "%02x%02x%02x%02x",
- 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, "%02x%02x%02x%02x%02x%02x",
- 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 = "";
- if (sp)
- snprintf(cport, sizeof(cport),
- "%s%s", *host ? "." : "", sp->s_name);
- else
- snprintf(cport, sizeof(cport),
- "%s%x", *host ? "." : "", port);
- } else
- *cport = 0;
-
- snprintf(mybuf, sizeof(mybuf), "%s.%s%s", net, host, cport);
- return(mybuf);
-}
-
-char *
-ipx_phost(struct sockaddr *sa)
-{
- register struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)sa;
- struct sockaddr_ipx work;
- static union ipx_net ipx_zeronet;
- char *p;
- struct ipx_addr in;
-
- work = *sipx;
- in = work.sipx_addr;
-
- work.sipx_addr.x_port = 0;
- work.sipx_addr.x_net = ipx_zeronet;
- p = ipx_print((struct sockaddr *)&work);
- if (strncmp("*.", p, 2) == 0) p += 2;
-
- return(p);
-}
-#endif
-#ifdef NS
-short ns_nullh[] = {0,0,0};
-short ns_bh[] = {-1,-1,-1};
-
-char *
-ns_print(struct sockaddr *sa)
-{
- register struct sockaddr_ns *sns = (struct sockaddr_ns*)sa;
- struct ns_addr work;
- union { union ns_net net_e; u_long long_e; } net;
- u_short port;
- static char mybuf[50], cport[10], chost[25];
- char *host = "";
- register char *p; register u_char *q;
-
- work = sns->sns_addr;
- port = ntohs(work.x_port);
- work.x_port = 0;
- net.net_e = work.x_net;
- if (ns_nullhost(work) && net.long_e == 0) {
- if (port ) {
- sprintf(mybuf, "*.%xH", port);
- upHex(mybuf);
- } else
- sprintf(mybuf, "*.*");
- return (mybuf);
- }
-
- if (bcmp(ns_bh, work.x_host.c_host, 6) == 0) {
- host = "any";
- } else if (bcmp(ns_nullh, work.x_host.c_host, 6) == 0) {
- host = "*";
- } else {
- q = work.x_host.c_host;
- sprintf(chost, "%02x%02x%02x%02x%02x%02xH",
- 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)
- sprintf(cport, ".%xH", htons(port));
- else
- *cport = 0;
-
- sprintf(mybuf,"%xH.%s%s", ntohl(net.long_e), host, cport);
- upHex(mybuf);
- return(mybuf);
-}
-
-char *
-ns_phost(struct sockaddr *sa)
-{
- register struct sockaddr_ns *sns = (struct sockaddr_ns *)sa;
- struct sockaddr_ns work;
- static union ns_net ns_zeronet;
- char *p;
-
- work = *sns;
- work.sns_addr.x_port = 0;
- work.sns_addr.x_net = ns_zeronet;
-
- p = ns_print((struct sockaddr *)&work);
- if (strncmp("0H.", p, 3) == 0)
- p += 3;
- return(p);
-}
-#endif