Module Name:    src
Committed By:   riz
Date:           Sun Nov  8 00:49:06 UTC 2015

Modified Files:
        src/usr.sbin/iostat [netbsd-7]: iostat.8 iostat.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1016):
        usr.sbin/iostat/iostat.c: revision 1.62
        usr.sbin/iostat/iostat.c: revision 1.63
        usr.sbin/iostat/iostat.8: revision 1.24
support fnmatch(3) patterns for disknames.  eg, "iostat wd*" works now.
update the default disk number selection to note that it uses the current
terminal size to fit disks, not hard coded 4.
extend the "tout" column to 5 characters, it's really common on a modern
machine to have eg, build output way more than 9999 chars/sec.
this doesn't affect the default disk list on an 80-char wide screen.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.2.1 src/usr.sbin/iostat/iostat.8
cvs rdiff -u -r1.61 -r1.61.2.1 src/usr.sbin/iostat/iostat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/iostat/iostat.8
diff -u src/usr.sbin/iostat/iostat.8:1.23 src/usr.sbin/iostat/iostat.8:1.23.2.1
--- src/usr.sbin/iostat/iostat.8:1.23	Wed Jun 11 17:01:04 2014
+++ src/usr.sbin/iostat/iostat.8	Sun Nov  8 00:49:06 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: iostat.8,v 1.23 2014/06/11 17:01:04 joerg Exp $
+.\"	$NetBSD: iostat.8,v 1.23.2.1 2015/11/08 00:49:06 riz Exp $
 .\"
 .\" Copyright (c) 1985, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)iostat.8	8.1 (Berkeley) 6/6/93
 .\"
-.Dd June 11, 2014
+.Dd July 9, 2015
 .Dt IOSTAT 8
 .Os
 .Sh NAME
@@ -142,13 +142,16 @@ characters written to terminals
 .It disks
 Disk operations.
 The header of the field is the disk name and unit number.
-If more than four disk drives are configured in the system,
+If more drives are configured in the system that fit across the
+current display,
 .Nm
-displays only the first four drives.
+displays only those drives that fit on the display.
 To force
 .Nm
-to display specific drives, their names may be supplied on the command
-line.
+to display specific drives, they may be supplied on the command
+line, either as names or
+.Fn fnmatch
+patterns.
 .Pp
 .Bl -tag -width indent -compact
 .It KB/t
@@ -189,6 +192,7 @@ Seconds spent in disk activity
 .Xr \&ps 1 ,
 .Xr systat 1 ,
 .Xr vmstat 1 ,
+.Xr fnmatch 3 ,
 .Xr pstat 8
 .Pp
 The sections starting with ``Interpreting system activity'' in

Index: src/usr.sbin/iostat/iostat.c
diff -u src/usr.sbin/iostat/iostat.c:1.61 src/usr.sbin/iostat/iostat.c:1.61.2.1
--- src/usr.sbin/iostat/iostat.c:1.61	Wed Jun 11 17:01:04 2014
+++ src/usr.sbin/iostat/iostat.c	Sun Nov  8 00:49:05 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $	*/
+/*	$NetBSD: iostat.c,v 1.61.2.1 2015/11/08 00:49:05 riz Exp $	*/
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@ __COPYRIGHT("@(#) Copyright (c) 1986, 19
 #if 0
 static char sccsid[] = "@(#)iostat.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.61.2.1 2015/11/08 00:49:05 riz Exp $");
 #endif
 #endif /* not lint */
 
@@ -88,6 +88,7 @@ __RCSID("$NetBSD: iostat.c,v 1.61 2014/0
 #include <string.h>
 #include <unistd.h>
 #include <math.h>
+#include <fnmatch.h>
 
 #include "drvstats.h"
 
@@ -183,7 +184,7 @@ main(int argc, char *argv[])
 	if (ISSET(todo, SHOW_CPU))
 		defdrives -= 16;	/* XXX magic number */
 	if (ISSET(todo, SHOW_TTY))
-		defdrives -= 9;		/* XXX magic number */
+		defdrives -= 10;	/* XXX magic number */
 	defdrives /= 18;		/* XXX magic number */
 
 	drvinit(0);
@@ -278,7 +279,7 @@ header(void)
 
 					/* Sub-Headers. */
 	if (ISSET(todo, SHOW_TTY))
-		printf(" tin tout");
+		printf(" tin  tout");
 
 	if (ISSET(todo, SHOW_STATS_1)) {
 		for (i = 0; i < ndrive; i++)
@@ -467,7 +468,7 @@ display(void)
 	}
 
 	if (ISSET(todo, SHOW_TTY))
-		printf("%4.0f %4.0f", cur.tk_nin / etime, cur.tk_nout / etime);
+		printf("%4.0f %5.0f", cur.tk_nin / etime, cur.tk_nout / etime);
 
 	if (ISSET(todo, SHOW_STATS_1)) {
 		drive_stats(etime);
@@ -511,7 +512,7 @@ selectdrives(int argc, char *argv[])
 #endif
 		tried++;
 		for (i = 0; i < (int)ndrive; i++) {
-			if (strcmp(cur.name[i], *argv))
+			if (fnmatch(*argv, cur.name[i], 0))
 				continue;
 			cur.select[i] = 1;
 			++ndrives;

Reply via email to