Dag-Erling Smorgrav <[EMAIL PROTECTED]> writes:
> Attached are patches [...]
...and here are the patches.
Noticed by: Peter Wemm <[EMAIL PROTECTED]>
DES
--
Dag-Erling Smorgrav - [EMAIL PROTECTED]
Index: src/usr.bin/netstat/inet.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/netstat/inet.c,v
retrieving revision 1.31
diff -u -r1.31 inet.c
--- inet.c 1999/03/10 17:25:42 1.31
+++ inet.c 1999/07/03 09:41:51
@@ -163,9 +163,7 @@
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 @@
}
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 @@
{
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 @@
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);
}
/*
Index: src/usr.bin/sockstat/sockstat.1
===================================================================
RCS file: /home/ncvs/src/usr.bin/sockstat/sockstat.1,v
retrieving revision 1.1
diff -u -r1.1 sockstat.1
--- sockstat.1 1999/04/15 13:40:43 1.1
+++ sockstat.1 1999/07/03 09:41:51
@@ -39,7 +39,7 @@
.Nm
command lists open Internet sockets. The information listed for each
socket is:
-.Bl -tag -width FOREIGN_ADDRESS
+.Bl -tag -width "FOREIGN ADDRESS"
.It Li USER
The user who owns the socket.
.It Li COMMAND
@@ -49,7 +49,7 @@
.It Li FD
The file descriptor number of the socket.
.It Li PROTO
-The transport protocol (udp or tcp) associated with the socket.
+The transport protocol associated with the socket.
.It Li LOCAL ADDRESS
The address the local end of the socket is bound to (see
.Xr getsockname 2 ).
@@ -59,8 +59,8 @@
.El
.Sh SEE ALSO
.Xr fstat 1 ,
-.Xr inet 4 ,
-.Xr netstat 1 .
+.Xr netstat 1 ,
+.Xr inet 4 .
.Sh HISTORY
The
.Nm
Index: src/usr.bin/sockstat/sockstat.pl
===================================================================
RCS file: /home/ncvs/src/usr.bin/sockstat/sockstat.pl,v
retrieving revision 1.2
diff -u -r1.2 sockstat.pl
--- sockstat.pl 1999/05/01 11:31:19 1.2
+++ sockstat.pl 1999/07/03 09:48:24
@@ -33,18 +33,17 @@
my ($user, $cmd, $pid, $fd, $inet, $type, $proto, $sock, $laddr, $faddr);
print <<EOH;
-USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
+USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
EOH
format STDOUT =
-@<<<<<<< @<<<<<<<<< @>>>> @>>> @<< @<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<
-$user, $cmd, $pid, $fd, $proto,$laddr, $faddr
+@<<<<<<< @<<<<<<< @>>>> @>>> @<<<<< @<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<
+$user, $cmd, $pid, $fd, $proto,$laddr, $faddr
.
-open NETSTAT, "netstat -Aan |" or die "'netstat -Aan' failed: $!";
+open NETSTAT, "netstat -Aan -finet | tail +3 |" or die "'netstat' failed: $!";
while (<NETSTAT>) {
my ($sock, $proto, $recvq, $sendq, $laddr, $faddr, $state) = split;
- next unless ($proto =~ m/tcp|udp/);
($myaddr{$sock}, $hisaddr{$sock}) = ($laddr, $faddr);
}
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message