Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/usr.bin/netstat Pull up revision 1.12 (requested by he):



details:   https://anonhg.NetBSD.org/src/rev/2e592c86afbc
branches:  netbsd-1-4
changeset: 471081:2e592c86afbc
user:      he <he%NetBSD.org@localhost>
date:      Thu Oct 19 16:32:12 2000 +0000

description:
Pull up revision 1.12 (requested by he):
  Format string cleanup.

diffstat:

 usr.bin/netstat/ns.c |  23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diffs (58 lines):

diff -r 8292ffdd70df -r 2e592c86afbc usr.bin/netstat/ns.c
--- a/usr.bin/netstat/ns.c      Thu Oct 19 16:32:09 2000 +0000
+++ b/usr.bin/netstat/ns.c      Thu Oct 19 16:32:12 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ns.c,v 1.11 1998/07/12 03:20:14 mrg Exp $      */
+/*     $NetBSD: ns.c,v 1.11.2.1 2000/10/19 16:32:12 he Exp $   */
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "from: @(#)ns.c 8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: ns.c,v 1.11 1998/07/12 03:20:14 mrg Exp $");
+__RCSID("$NetBSD: ns.c,v 1.11.2.1 2000/10/19 16:32:12 he Exp $");
 #endif
 #endif /* not lint */
 
@@ -95,7 +95,7 @@
        struct nspcb cb;
        struct nspcb *prev, *next;
        int isspp;
-
+       int width = 22;
        if (off == 0)
                return;
        isspp = strcmp(name, "spp") == 0;
@@ -132,21 +132,22 @@
                        if (aflag)
                                printf(" (including servers)");
                        putchar('\n');
-                       if (Aflag)
+                       if (Aflag) {
                                printf("%-8.8s ", "PCB");
-                       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",
-                               "Proto", "Recv-Q", "Send-Q",
-                               "Local Address", "Foreign Address", "(state)");
+                               width = 18;
+                       }
+                       printf("%-5.5s %-6.6s %-6.6s  %-*.*s %-*.*s %s\n",
+                              "Proto", "Recv-Q", "Send-Q",
+                              width, width, "Local Address", 
+                              width, width, "Foreign Address", "(state)");
                        first = 0;
                }
                if (Aflag)
                        printf("%8lx ", ppcb);
                printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc,
                        sockb.so_snd.sb_cc);
-               printf("  %-22.22s", ns_prpr(&nspcb.nsp_laddr));
-               printf(" %-22.22s", ns_prpr(&nspcb.nsp_faddr));
+               printf("  %-*.*s", width, width, ns_prpr(&nspcb.nsp_laddr));
+               printf(" %-*.*s", width, width, ns_prpr(&nspcb.nsp_faddr));
                if (isspp) {
                        extern char *tcpstates[];
                        if (sppcb.s_state >= TCP_NSTATES)



Home | Main Index | Thread Index | Old Index