> Hmm, I've just noticed some small misalignment of column headings in the
> default output.  I'll fix that too.
> 
> Stephen.

I also noticed that my another IPv6 related change is one of
main cause of the misalignment.
So I also tried to make patches for it, including
"netstat -f inet -i" issue.

Does these patches fix your problem, or should another better
fix is desired? Please give me any opinions.

Yoshinobu Inoue


Index: inet.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/netstat/inet.c,v
retrieving revision 1.36
diff -u -r1.36 inet.c
--- inet.c      1999/12/13 20:08:43     1.36
+++ inet.c      2000/01/06 11:57:57
@@ -219,7 +219,7 @@
                        if (Aflag)
                                printf("%-8.8s ", "Socket");
                        if (Lflag)
-                               printf("%-14.14s %-21.21s\n",
+                               printf("%-14.14s %-22.22s\n",
                                        "Listen", "Local Address");
                        else
                                printf(Aflag ?
@@ -245,15 +245,22 @@
                                printf("%-14.14s ", buf);
                        } else
                                continue;
-               else
-                       printf("%-3.3s%s%s %6ld %6ld ", name,
-                              (inp->inp_vflag & INP_IPV4) ? "4" : "",
+               else {
+                       const u_char *vchar;
+
 #ifdef INET6
-                              (inp->inp_vflag & INP_IPV6) ? "6" :
+                       if ((inp->inp_vflag & INP_IPV6) != 0)
+                               vchar = ((inp->inp_vflag & INP_IPV4) != 0)
+                                       ? "46" : "6 ";
+                       else
 #endif
-                              "",
+                       vchar = ((inp->inp_vflag & INP_IPV4) != 0)
+                                       ? "4 " : "  ";
+
+                       printf("%-3.3s%-2.2s %6ld %6ld  ", name, vchar,
                               so->so_rcv.sb_cc,
                               so->so_snd.sb_cc);
+               }
                if (nflag) {
                        if (inp->inp_vflag & INP_IPV4) {
                                inetprint(&inp->inp_laddr, (int)inp->inp_lport,
@@ -801,7 +808,7 @@
        else
                sprintf(cp, "%d", ntohs((u_short)port));
        width = Aflag ? 18 : 22;
-       printf(" %-*.*s", width, width, line);
+       printf("%-*.*s ", width, width, line);
 }
 
 /*
Index: inet6.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/netstat/inet6.c,v
retrieving revision 1.2
diff -u -r1.2 inet6.c
--- inet6.c     1999/12/28 02:37:01     1.2
+++ inet6.c     2000/01/06 11:57:57
@@ -904,7 +904,7 @@
        else
                sprintf(cp, "%d", ntohs((u_short)port));
        width = lflag ? 45 : Aflag ? 18 : 22;
-       printf(" %-*.*s", width, width, line);
+       printf("%-*.*s ", width, width, line);
 }
 
 /*
Index: main.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/netstat/main.c,v
retrieving revision 1.31
diff -u -r1.31 main.c
--- main.c      1999/12/28 02:37:01     1.31
+++ main.c      2000/01/06 11:57:57
@@ -460,7 +460,7 @@
         */
 #endif
        if (iflag) {
-               if (af != AF_UNSPEC)
+               if (sflag && af != AF_UNSPEC)
                        goto protostat;
 
                kread(0, 0, 0);


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to