Print appletalk layer 3 addresses as 16 bit unsigned decimal numbers,

not two 8 bit values.  This conforms to industry standard.

These changes have been sent back to LBL.
This commit is contained in:
Paul Traina 1996-09-11 06:18:26 +00:00
parent 04812bca5a
commit 36c6738a68

View File

@ -504,26 +504,24 @@ ataddr_string(u_short atnet, u_char athost)
if (first && (first = 0, !nflag)
&& (fp = fopen("/etc/atalk.names", "r"))) {
char line[256];
int i1, i2, i3;
int i1, i2;
while (fgets(line, sizeof(line), fp)) {
if (line[0] == '\n' || line[0] == 0 || line[0] == '#')
continue;
if (sscanf(line, "%d.%d.%d %s", &i1, &i2, &i3,
nambuf) == 4)
if (sscanf(line, "%d.%d %s", &i1, &i2, nambuf) == 3)
/* got a hostname. */
i3 |= ((i1 << 8) | i2) << 8;
else if (sscanf(line, "%d.%d %s", &i1, &i2,
nambuf) == 3)
i2 |= (i1 << 8);
else if (sscanf(line, "%d %s", &i1, nambuf) == 2)
/* got a net name */
i3 = (((i1 << 8) | i2) << 8) | 255;
i2 = (i1 << 8) | 255;
else
continue;
for (tp = &hnametable[i3 & (HASHNAMESIZE-1)];
for (tp = &hnametable[i2 & (HASHNAMESIZE-1)];
tp->nxt; tp = tp->nxt)
;
tp->addr = i3;
tp->addr = i2;
tp->nxt = newhnamemem();
tp->name = savestr(nambuf);
}
@ -548,10 +546,9 @@ ataddr_string(u_short atnet, u_char athost)
tp->addr = (atnet << 8) | athost;
tp->nxt = newhnamemem();
if (athost != 255)
(void)sprintf(nambuf, "%d.%d.%d",
atnet >> 8, atnet & 0xff, athost);
(void)sprintf(nambuf, "%d.%d", atnet, athost);
else
(void)sprintf(nambuf, "%d.%d", atnet >> 8, atnet & 0xff);
(void)sprintf(nambuf, "%d", atnet);
tp->name = savestr(nambuf);
return (tp->name);