summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-06-29 21:46:07 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-06-29 21:46:07 +0000
commit73e3215c3918f21ebe935bf879071e6dbf6c842a (patch)
tree71714ba84b4853edadfc59c2abb5ccbbd44d545c /usr.bin
parent943105aef5e4f1338044d35f1376f59f9d03b9c2 (diff)
Use correct spacing on both 32bit and 64bit machines.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/netstat/if.c5
-rw-r--r--usr.bin/netstat/inet.c24
-rw-r--r--usr.bin/netstat/ipx.c24
-rw-r--r--usr.bin/netstat/iso.c39
-rw-r--r--usr.bin/netstat/mbuf.c5
-rw-r--r--usr.bin/netstat/mroute.c3
-rw-r--r--usr.bin/netstat/netstat.h9
-rw-r--r--usr.bin/netstat/ns.c5
-rw-r--r--usr.bin/netstat/route.c9
-rw-r--r--usr.bin/netstat/unix.c20
10 files changed, 86 insertions, 57 deletions
diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c
index 2a3589035b3..df08a64794c 100644
--- a/usr.bin/netstat/if.c
+++ b/usr.bin/netstat/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.12 1997/06/29 20:52:39 millert Exp $ */
+/* $OpenBSD: if.c,v 1.13 1997/06/29 21:46:00 millert Exp $ */
/* $NetBSD: if.c,v 1.16.4.2 1996/06/07 21:46:46 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
#else
-static char *rcsid = "$OpenBSD: if.c,v 1.12 1997/06/29 20:52:39 millert Exp $";
+static char *rcsid = "$OpenBSD: if.c,v 1.13 1997/06/29 21:46:00 millert Exp $";
#endif
#endif /* not lint */
@@ -60,6 +60,7 @@ static char *rcsid = "$OpenBSD: if.c,v 1.12 1997/06/29 20:52:39 millert Exp $";
#include <netiso/iso_var.h>
#include <arpa/inet.h>
+#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 8d52d87edc8..ec942918af1 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet.c,v 1.17 1997/06/29 20:52:39 millert Exp $ */
+/* $OpenBSD: inet.c,v 1.18 1997/06/29 21:46:01 millert Exp $ */
/* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
-static char *rcsid = "$OpenBSD: inet.c,v 1.17 1997/06/29 20:52:39 millert Exp $";
+static char *rcsid = "$OpenBSD: inet.c,v 1.18 1997/06/29 21:46:01 millert Exp $";
#endif
#endif /* not lint */
@@ -73,6 +73,7 @@ static char *rcsid = "$OpenBSD: inet.c,v 1.17 1997/06/29 20:52:39 millert Exp $"
#include <netinet/ip_ip4.h>
#include <arpa/inet.h>
+#include <limits.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
@@ -139,19 +140,22 @@ protopr(off, name)
printf(" (including servers)");
putchar('\n');
if (Aflag)
- printf("%-18.18s ", "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)");
+ printf("%-*.*s %-5.5s %-6.6s %-6.6s %-*.*s %-*.*s %s\n",
+ PLEN, PLEN, "PCB", "Proto", "Recv-Q",
+ "Send-Q", PLEN, PLEN, "Local Address",
+ PLEN, PLEN, "Foreign Address", "(state)");
+ else
+ printf("%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n",
+ "Proto", "Recv-Q", "Send-Q",
+ "Local Address", "Foreign Address",
+ "(state)");
first = 0;
}
if (Aflag)
if (istcp)
- printf("%18p ", inpcb.inp_ppcb);
+ printf("%*p ", PLEN, inpcb.inp_ppcb);
else
- printf("%18p ", prev);
+ printf("%*p ", PLEN, prev);
printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc,
sockb.so_snd.sb_cc);
inetprint(&inpcb.inp_laddr, (int)inpcb.inp_lport, name, 1);
diff --git a/usr.bin/netstat/ipx.c b/usr.bin/netstat/ipx.c
index 92b1926c3c1..cd36cee4b55 100644
--- a/usr.bin/netstat/ipx.c
+++ b/usr.bin/netstat/ipx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipx.c,v 1.3 1997/06/29 20:52:40 millert Exp $ */
+/* $OpenBSD: ipx.c,v 1.4 1997/06/29 21:46:01 millert Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)ns.c 8.1 (Berkeley) 6/6/93";
#else
-static char *rcsid = "$OpenBSD: ipx.c,v 1.3 1997/06/29 20:52:40 millert Exp $";
+static char *rcsid = "$OpenBSD: ipx.c,v 1.4 1997/06/29 21:46:01 millert Exp $";
#endif
#endif /* not lint */
@@ -64,6 +64,7 @@ static char *rcsid = "$OpenBSD: ipx.c,v 1.3 1997/06/29 20:52:40 millert Exp $";
#define SANAMES
#include <netipx/spx_debug.h>
+#include <limits.h>
#include <nlist.h>
#include <errno.h>
#include <stdio.h>
@@ -126,17 +127,20 @@ ipxprotopr(off, name)
if (aflag)
printf(" (including servers)");
putchar('\n');
- if (Aflag)
- printf("%-18.18s ", "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)");
+ if (Aflag)
+ printf("%-*.*s %-5.5s %-6.6s %-6.6s %-*.*s %-*.*s %s\n",
+ PLEN, PLEN, "PCB", "Proto", "Recv-Q",
+ "Send-Q", PLEN, PLEN, "Local Address",
+ PLEN, PLEN, "Foreign Address", "(state)");
+ else
+ printf("%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n",
+ "Proto", "Recv-Q", "Send-Q",
+ "Local Address", "Foreign Address",
+ "(state)");
first = 0;
}
if (Aflag)
- printf("%18p ", ipxpcb.ipxp_ppcb);
+ printf("%*p ", PLEN, ipxpcb.ipxp_ppcb);
printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc,
sockb.so_snd.sb_cc);
printf(" %-22.22s", ipx_prpr(&ipxpcb.ipxp_laddr));
diff --git a/usr.bin/netstat/iso.c b/usr.bin/netstat/iso.c
index e2fe3498359..70794634d87 100644
--- a/usr.bin/netstat/iso.c
+++ b/usr.bin/netstat/iso.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iso.c,v 1.5 1997/06/29 20:52:41 millert Exp $ */
+/* $OpenBSD: iso.c,v 1.6 1997/06/29 21:46:02 millert Exp $ */
/* $NetBSD: iso.c,v 1.12 1995/10/03 21:42:38 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)iso.c 8.1 (Berkeley) 6/6/93";
#else
-static char *rcsid = "$OpenBSD: iso.c,v 1.5 1997/06/29 20:52:41 millert Exp $";
+static char *rcsid = "$OpenBSD: iso.c,v 1.6 1997/06/29 21:46:02 millert Exp $";
#endif
#endif /* not lint */
@@ -104,6 +104,7 @@ SOFTWARE.
#endif
#include <netiso/cons_pcb.h>
#include <arpa/inet.h>
+#include <limits.h>
#include <netdb.h>
#include <string.h>
#include <stdio.h>
@@ -266,17 +267,20 @@ iso_protopr1(kern_addr, istp)
printf(" (including servers)");
putchar('\n');
if (Aflag)
- printf("%-18.18s ", "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)");
+ printf("%-*.*s %-5.5s %-6.6s %-6.6s %-*.*s %-*.*s %s\n",
+ PLEN, PLEN, "PCB", "Proto", "Recv-Q",
+ "Send-Q", PLEN, PLEN, "Local Address",
+ PLEN, PLEN, "Foreign Address", "(state)");
+ else
+ printf("%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n",
+ "Proto", "Recv-Q", "Send-Q",
+ "Local Address", "Foreign Address",
+ "(state)");
first = 0;
}
if (Aflag)
- printf("%18p ",
- (sockb.so_pcb ? (void *)sockb.so_pcb : (void *)kern_addr));
+ printf("%*p ", PLEN,
+ (sockb.so_pcb ? (void *)sockb.so_pcb : (void *)kern_addr));
printf("%-5.5s %6ld %6ld ", "tp", sockb.so_rcv.sb_cc,
sockb.so_snd.sb_cc);
if (istp && tpcb.tp_lsuffixlen) {
@@ -510,12 +514,15 @@ x25_protopr(off, name)
printf(" (including servers)");
putchar('\n');
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)");
+ printf("%-*.*s %-5.5s %-6.6s %-6.6s %-*.*s %-*.*s %s\n",
+ PLEN, PLEN, "PCB", "Proto", "Recv-Q",
+ "Send-Q", PLEN, PLEN, "Local Address",
+ PLEN, PLEN, "Foreign Address", "(state)");
+ else
+ printf("%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s %s\n",
+ "Proto", "Recv-Q", "Send-Q",
+ "Local Address", "Foreign Address",
+ "(state)");
first = 0;
}
printf("%-5.5s %6d %6d ", name, sockb.so_rcv.sb_cc,
diff --git a/usr.bin/netstat/mbuf.c b/usr.bin/netstat/mbuf.c
index 4874c4102b6..a8fd9e3fb21 100644
--- a/usr.bin/netstat/mbuf.c
+++ b/usr.bin/netstat/mbuf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mbuf.c,v 1.4 1997/06/29 20:18:01 millert Exp $ */
+/* $OpenBSD: mbuf.c,v 1.5 1997/06/29 21:46:03 millert Exp $ */
/* $NetBSD: mbuf.c,v 1.9 1996/05/07 02:55:03 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)mbuf.c 8.1 (Berkeley) 6/6/93";
#else
-static char *rcsid = "$OpenBSD: mbuf.c,v 1.4 1997/06/29 20:18:01 millert Exp $";
+static char *rcsid = "$OpenBSD: mbuf.c,v 1.5 1997/06/29 21:46:03 millert Exp $";
#endif
#endif /* not lint */
@@ -47,6 +47,7 @@ static char *rcsid = "$OpenBSD: mbuf.c,v 1.4 1997/06/29 20:18:01 millert Exp $";
#include <sys/socket.h>
#include <sys/mbuf.h>
+#include <limits.h>
#include <stdio.h>
#include "netstat.h"
diff --git a/usr.bin/netstat/mroute.c b/usr.bin/netstat/mroute.c
index 58b7a7cf3fc..2aac6025700 100644
--- a/usr.bin/netstat/mroute.c
+++ b/usr.bin/netstat/mroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mroute.c,v 1.4 1997/06/29 20:18:02 millert Exp $ */
+/* $OpenBSD: mroute.c,v 1.5 1997/06/29 21:46:03 millert Exp $ */
/* $NetBSD: mroute.c,v 1.10 1996/05/11 13:51:27 mycroft Exp $ */
/*
@@ -59,6 +59,7 @@
#include <netinet/ip_mroute.h>
#undef _KERNEL
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include "netstat.h"
diff --git a/usr.bin/netstat/netstat.h b/usr.bin/netstat/netstat.h
index 8626e8fcf5c..2e61c427f12 100644
--- a/usr.bin/netstat/netstat.h
+++ b/usr.bin/netstat/netstat.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: netstat.h,v 1.7 1997/06/29 20:18:02 millert Exp $ */
+/* $OpenBSD: netstat.h,v 1.8 1997/06/29 21:46:04 millert Exp $ */
/* $NetBSD: netstat.h,v 1.6 1996/05/07 02:55:05 thorpej Exp $ */
/*
@@ -38,6 +38,13 @@
#include <sys/cdefs.h>
+/* What is the max length of a pointer printed with %p? */
+#if (UINT_MAX == ULONG_MAX)
+#define PLEN 10
+#else
+#define PLEN 18
+#endif
+
int Aflag; /* show addresses of protocol control block */
int aflag; /* show all sockets (including servers) */
int dflag; /* show i/f dropped packets */
diff --git a/usr.bin/netstat/ns.c b/usr.bin/netstat/ns.c
index 658c857ea60..0da7a684a81 100644
--- a/usr.bin/netstat/ns.c
+++ b/usr.bin/netstat/ns.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ns.c,v 1.3 1997/06/29 20:18:03 millert Exp $ */
+/* $OpenBSD: ns.c,v 1.4 1997/06/29 21:46:05 millert Exp $ */
/* $NetBSD: ns.c,v 1.8 1995/10/03 21:42:46 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)ns.c 8.1 (Berkeley) 6/6/93";
#else
-static char *rcsid = "$OpenBSD: ns.c,v 1.3 1997/06/29 20:18:03 millert Exp $";
+static char *rcsid = "$OpenBSD: ns.c,v 1.4 1997/06/29 21:46:05 millert Exp $";
#endif
#endif /* not lint */
@@ -65,6 +65,7 @@ static char *rcsid = "$OpenBSD: ns.c,v 1.3 1997/06/29 20:18:03 millert Exp $";
#define SANAMES
#include <netns/spp_debug.h>
+#include <limits.h>
#include <nlist.h>
#include <errno.h>
#include <stdio.h>
diff --git a/usr.bin/netstat/route.c b/usr.bin/netstat/route.c
index 4ff7da9f6d8..eed6e75cc44 100644
--- a/usr.bin/netstat/route.c
+++ b/usr.bin/netstat/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.14 1997/06/29 20:52:41 millert Exp $ */
+/* $OpenBSD: route.c,v 1.15 1997/06/29 21:46:06 millert Exp $ */
/* $NetBSD: route.c,v 1.15 1996/05/07 02:55:06 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)route.c 8.3 (Berkeley) 3/9/94";
#else
-static char *rcsid = "$OpenBSD: route.c,v 1.14 1997/06/29 20:52:41 millert Exp $";
+static char *rcsid = "$OpenBSD: route.c,v 1.15 1997/06/29 21:46:06 millert Exp $";
#endif
#endif /* not lint */
@@ -62,6 +62,7 @@ static char *rcsid = "$OpenBSD: route.c,v 1.14 1997/06/29 20:52:41 millert Exp $
#include <sys/sysctl.h>
+#include <limits.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
@@ -216,7 +217,7 @@ pr_rthdr()
{
if (Aflag)
- printf("%-18.18s ","Address");
+ printf("%-*.*s ", PLEN, PLEN, "Address");
printf("%-*.*s %-*.*s %-6.6s %6.6s%16.16s %6.6s %s\n",
WID_DST, WID_DST, "Destination",
WID_GW, WID_GW, "Gateway",
@@ -230,7 +231,7 @@ void
pr_encaphdr()
{
if (Aflag)
- printf("%-18s ", "Address");
+ printf("%-*s ", PLEN, "Address");
printf("%-15s %-15s %-5s %-15s %-15s %-5s %-5s %-15s %-8s %s\n",
"Source address", "Source mask", "Port", "Dest. address",
"Dest. mask", "Port", "Proto", "Tunnel exit",
diff --git a/usr.bin/netstat/unix.c b/usr.bin/netstat/unix.c
index b097c38a310..0f8846c4d22 100644
--- a/usr.bin/netstat/unix.c
+++ b/usr.bin/netstat/unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unix.c,v 1.4 1997/06/29 20:52:42 millert Exp $ */
+/* $OpenBSD: unix.c,v 1.5 1997/06/29 21:46:06 millert Exp $ */
/* $NetBSD: unix.c,v 1.13 1995/10/03 21:42:48 thorpej Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)unix.c 8.1 (Berkeley) 6/6/93";
#else
-static char *rcsid = "$OpenBSD: unix.c,v 1.4 1997/06/29 20:52:42 millert Exp $";
+static char *rcsid = "$OpenBSD: unix.c,v 1.5 1997/06/29 21:46:06 millert Exp $";
#endif
#endif /* not lint */
@@ -60,6 +60,7 @@ struct proc;
#include <netinet/in.h>
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <kvm.h>
@@ -124,15 +125,16 @@ unixdomainpr(so, soaddr)
if (first) {
printf("Active UNIX domain sockets\n");
printf(
-"%-18.18s %-6.6s %-6.6s %-6.6s %18.18s %18.18s %18.18s %18.18s Addr\n",
- "Address", "Type", "Recv-Q", "Send-Q",
- "Inode", "Conn", "Refs", "Nextref");
+"%-*.*s %-6.6s %-6.6s %-6.6s %*.*s %*.*s %*.*s %*.*s Addr\n",
+ PLEN, PLEN, "Address", "Type", "Recv-Q", "Send-Q",
+ PLEN, PLEN, "Inode", PLEN, PLEN, "Conn",
+ PLEN, PLEN, "Refs", PLEN, PLEN, "Nextref");
first = 0;
}
- printf("%18p %-6.6s %6ld %6ld %18p %18p %18p %18p",
- soaddr, socktype[so->so_type], so->so_rcv.sb_cc, so->so_snd.sb_cc,
- unp->unp_vnode, unp->unp_conn,
- unp->unp_refs, unp->unp_nextref);
+ printf("%*p %-6.6s %6ld %6ld %*p %*p %*p %*p",
+ PLEN, soaddr, socktype[so->so_type], so->so_rcv.sb_cc,
+ so->so_snd.sb_cc, PLEN, unp->unp_vnode, PLEN, unp->unp_conn,
+ PLEN, unp->unp_refs, PLEN, unp->unp_nextref);
if (m)
printf(" %.*s",
m->m_len - (int)(sizeof(*sa) - sizeof(sa->sun_path)),