summaryrefslogtreecommitdiffstats
path: root/usr.bin/netstat
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>1999-07-06 19:10:15 +0000
committerdes <des@FreeBSD.org>1999-07-06 19:10:15 +0000
commitf234b406a45a445cc33488b6a9260e82cb4d01b8 (patch)
treefc53a158f0821b5d9739dcb0f438a53755df39cf /usr.bin/netstat
parentda04278417936cf93ca59565f383bc1689dc64c8 (diff)
downloadFreeBSD-src-f234b406a45a445cc33488b6a9260e82cb4d01b8.zip
FreeBSD-src-f234b406a45a445cc33488b6a9260e82cb4d01b8.tar.gz
Don't truncate port numbers.
Submitted by: ru
Diffstat (limited to 'usr.bin/netstat')
-rw-r--r--usr.bin/netstat/inet.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index ec5d4c9..08777aa 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)inet.c 8.5 (Berkeley) 5/24/95";
*/
static const char rcsid[] =
- "$Id: inet.c,v 1.30 1998/07/06 21:01:23 bde Exp $";
+ "$Id: inet.c,v 1.31 1999/03/10 17:25:42 des Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -163,9 +163,7 @@ protopr(proto, name)
putchar('\n');
if (Aflag)
printf("%-8.8s ", "Socket");
- printf(Aflag ?
- "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s %s\n" :
- "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n",
+ printf("%-5.5s %-6.6s %-6.6s %-21.21s %-21.21s %s\n",
"Proto", "Recv-Q", "Send-Q",
"Local Address", "Foreign Address", "(state)");
first = 0;
@@ -196,9 +194,9 @@ protopr(proto, name)
}
if (istcp) {
if (tp->t_state < 0 || tp->t_state >= TCP_NSTATES)
- printf(" %d", tp->t_state);
+ printf("%d", tp->t_state);
else {
- printf(" %s", tcpstates[tp->t_state]);
+ printf("%s", tcpstates[tp->t_state]);
#if defined(TF_NEEDSYN) && defined(TF_NEEDFIN)
/* Show T/TCP `hidden state' */
if (tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN))
@@ -555,7 +553,6 @@ inetprint(in, port, proto,numeric)
{
struct servent *sp = 0;
char line[80], *cp;
- int width;
sprintf(line, "%.*s.", (Aflag && !numeric) ? 12 : 16, inetname(in));
cp = index(line, '\0');
@@ -565,8 +562,7 @@ inetprint(in, port, proto,numeric)
sprintf(cp, "%.15s", sp ? sp->s_name : "*");
else
sprintf(cp, "%d", ntohs((u_short)port));
- width = Aflag ? 18 : 22;
- printf(" %-*.*s", width, width, line);
+ printf("%-21.21s ", line);
}
/*
OpenPOWER on IntegriCloud