Date: Thu, 24 Jul 1997 02:44:12 -0700 (PDT) From: denny1@home.com To: freebsd-gnats-submit@FreeBSD.ORG Subject: bin/4157: netstat atalk output should print symbolic names for port #s Message-ID: <199707240944.CAA19936@hub.freebsd.org> Resent-Message-ID: <199707240950.CAA20156@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 4157
>Category: bin
>Synopsis: netstat atalk output should print symbolic names for port #s
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Thu Jul 24 02:50:00 PDT 1997
>Last-Modified:
>Originator: Denny Gentry
>Organization:
>Release: N/A
>Environment:
Identified while bringing up netatalk on OpenBSD, relied
heavily on the FreeBSD code. Trying to contribute changes back.
>Description:
/usr/bin/netstat -a always prints appletalk ports numerically.
Would like it to getservbyname and print the symbolic name.
>How-To-Repeat:
>Fix:
At line 118 of atalk.c, replace:
sprintf(mybuf,"%d",(unsigned int)sat->sat_port);
with:
if (nflag)
(void) snprintf(mybuf, sizeof(mybuf), "%d",
(unsigned int) sat->sat_port);
else {
serv = getservbyport(sat->sat_port, "ddp");
if (serv == NULL)
(void) snprintf(mybuf, sizeof(mybuf), "%d",
(unsigned int) sat->sat_port);
else
(void) snprintf(mybuf, sizeof(mybuf), "%s",
serv->s_name);
}
return mybuf;
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707240944.CAA19936>
