better appletalk support.
This commit is contained in:
parent
f12d1a5dd0
commit
cae2a25e65
@ -70,6 +70,99 @@ static int first = 1;
|
||||
* -a (all) flag is specified.
|
||||
*/
|
||||
|
||||
char *
|
||||
at_pr_net(struct sockaddr_at *sat)
|
||||
{
|
||||
static char mybuf[50];
|
||||
|
||||
switch(sat->sat_addr.s_net) {
|
||||
case ATADDR_ANYNODE:
|
||||
return("any");
|
||||
case ATADDR_BCAST:
|
||||
return "bcast";
|
||||
default:
|
||||
sprintf(mybuf,"%hd",ntohs(sat->sat_addr.s_net));
|
||||
}
|
||||
return mybuf;
|
||||
}
|
||||
|
||||
char *
|
||||
at_pr_host(struct sockaddr_at *sat)
|
||||
{
|
||||
static char mybuf[50];
|
||||
|
||||
switch(sat->sat_addr.s_node) {
|
||||
case 0:
|
||||
return("local");
|
||||
case /*ATADDR_ANYNET*/0xffff:
|
||||
return "????";
|
||||
default:
|
||||
sprintf(mybuf,"%d",(unsigned int)sat->sat_addr.s_node);
|
||||
}
|
||||
return mybuf;
|
||||
}
|
||||
|
||||
char *
|
||||
at_pr_port(struct sockaddr_at *sat)
|
||||
{
|
||||
static char mybuf[50];
|
||||
|
||||
switch(sat->sat_port) {
|
||||
case ATADDR_ANYPORT:
|
||||
return("any");
|
||||
case 0xff:
|
||||
return "????";
|
||||
default:
|
||||
sprintf(mybuf,"%d",(unsigned int)sat->sat_port);
|
||||
}
|
||||
return mybuf;
|
||||
}
|
||||
|
||||
/* what == 0 for addr only == 3 */
|
||||
/* 1 for net */
|
||||
/* 2 for host */
|
||||
/* 4 for port */
|
||||
char *
|
||||
atalk_print(sa,what)
|
||||
register struct sockaddr *sa;
|
||||
{
|
||||
struct sockaddr_at *sat = (struct sockaddr_at *)sa;
|
||||
static char mybuf[50];
|
||||
|
||||
mybuf[0] = 0;
|
||||
switch (what & 3 ) {
|
||||
case 0:
|
||||
mybuf[0] = 0;
|
||||
break;
|
||||
case 1:
|
||||
sprintf(mybuf,"%s",at_pr_net(sat));
|
||||
break;
|
||||
case 2:
|
||||
sprintf(mybuf,"%s",at_pr_host(sat));
|
||||
break;
|
||||
case 3:
|
||||
sprintf(mybuf,"[%s.%s]",
|
||||
at_pr_net(sat),
|
||||
at_pr_host(sat));
|
||||
}
|
||||
if (what & 4) {
|
||||
sprintf(mybuf+strlen(mybuf),"%s",at_pr_port(sat));
|
||||
}
|
||||
#if 0
|
||||
switch(sat->sat_hints.type) {
|
||||
case SATHINT_NONE:
|
||||
sprintf(mybuf,"[no type]");
|
||||
break;
|
||||
case SATHINT_CONFIG:
|
||||
case SATHINT_IFACE:
|
||||
sprintf(mybuf,"[too hard for now]");
|
||||
break;
|
||||
default:
|
||||
sprintf(mybuf,"[unknown type]");
|
||||
}
|
||||
#endif
|
||||
return mybuf;
|
||||
}
|
||||
void
|
||||
atalkprotopr(off, name)
|
||||
u_long off;
|
||||
@ -115,9 +208,9 @@ atalkprotopr(off, name)
|
||||
printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc,
|
||||
sockb.so_snd.sb_cc);
|
||||
printf(Aflag?" %-18.18s":" %-22.22s", atalk_print(
|
||||
(struct sockaddr *)&ddpcb.ddp_lsat));
|
||||
(struct sockaddr *)&ddpcb.ddp_lsat,7));
|
||||
printf(Aflag?" %-18.18s":" %-22.22s", atalk_print(
|
||||
(struct sockaddr *)&ddpcb.ddp_fsat));
|
||||
(struct sockaddr *)&ddpcb.ddp_fsat,7));
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ void upHex __P((char *));
|
||||
|
||||
char *routename __P((u_long));
|
||||
char *netname __P((u_long, u_long));
|
||||
char *atalk_print __P((struct sockaddr *));
|
||||
char *atalk_print __P((struct sockaddr *,int));
|
||||
char *ipx_print __P((struct sockaddr *));
|
||||
char *ns_print __P((struct sockaddr *));
|
||||
void routepr __P((u_long));
|
||||
|
@ -36,7 +36,7 @@
|
||||
static char sccsid[] = "From: @(#)route.c 8.6 (Berkeley) 4/28/95";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: route.c,v 1.13 1996/06/02 23:19:11 alex Exp $";
|
||||
"$Id: route.c,v 1.14 1996/06/08 00:20:42 julian Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -416,10 +416,9 @@ p_sockaddr(sa, mask, flags, width)
|
||||
}
|
||||
case AF_APPLETALK:
|
||||
{
|
||||
cp = atalk_print(sa);
|
||||
cp = atalk_print(sa,3);
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef NS
|
||||
case AF_NS:
|
||||
cp = ns_print(sa);
|
||||
@ -714,41 +713,6 @@ rt_stats(off)
|
||||
rtstat.rts_wildcard, plural(rtstat.rts_wildcard));
|
||||
}
|
||||
|
||||
char *
|
||||
at_addr_print(ata)
|
||||
struct at_addr *ata;
|
||||
{
|
||||
static char mybuf[50];
|
||||
|
||||
sprintf(mybuf,"[%hd.%d]",ntohs(ata->s_net),(unsigned long)ata->s_node);
|
||||
return mybuf;
|
||||
}
|
||||
|
||||
char *
|
||||
atalk_print(sa)
|
||||
register struct sockaddr *sa;
|
||||
{
|
||||
struct sockaddr_at *sat = (struct sockaddr_at *)sa;
|
||||
static char mybuf[50];
|
||||
|
||||
strcpy(mybuf,at_addr_print(&sat->sat_addr));
|
||||
sprintf(mybuf+strlen(mybuf),":%d",sat->sat_port);
|
||||
#if 0
|
||||
switch(sat->sat_hints.type) {
|
||||
case SATHINT_NONE:
|
||||
sprintf(mybuf,"[no type]");
|
||||
break;
|
||||
case SATHINT_CONFIG:
|
||||
case SATHINT_IFACE:
|
||||
sprintf(mybuf,"[too hard for now]");
|
||||
break;
|
||||
default:
|
||||
sprintf(mybuf,"[unknown type]");
|
||||
}
|
||||
#endif
|
||||
return mybuf;
|
||||
}
|
||||
|
||||
char *
|
||||
ipx_print(sa)
|
||||
register struct sockaddr *sa;
|
||||
|
Loading…
Reference in New Issue
Block a user