Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/iostat support fnmatch(3) patterns for disknames. ...



details:   https://anonhg.NetBSD.org/src/rev/e33f28dc29ce
branches:  trunk
changeset: 339273:e33f28dc29ce
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Jul 09 13:26:52 2015 +0000

description:
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.

diffstat:

 usr.sbin/iostat/iostat.8 |  16 ++++++++++------
 usr.sbin/iostat/iostat.c |   7 ++++---
 2 files changed, 14 insertions(+), 9 deletions(-)

diffs (82 lines):

diff -r a1591b605377 -r e33f28dc29ce usr.sbin/iostat/iostat.8
--- a/usr.sbin/iostat/iostat.8  Thu Jul 09 12:32:16 2015 +0000
+++ b/usr.sbin/iostat/iostat.8  Thu Jul 09 13:26:52 2015 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: iostat.8,v 1.23 2014/06/11 17:01:04 joerg Exp $
+.\"    $NetBSD: iostat.8,v 1.24 2015/07/09 13:26:52 mrg 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 @@
 .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 @@
 .Xr \&ps 1 ,
 .Xr systat 1 ,
 .Xr vmstat 1 ,
+.Xr fnmatch 3 ,
 .Xr pstat 8
 .Pp
 The sections starting with ``Interpreting system activity'' in
diff -r a1591b605377 -r e33f28dc29ce usr.sbin/iostat/iostat.c
--- a/usr.sbin/iostat/iostat.c  Thu Jul 09 12:32:16 2015 +0000
+++ b/usr.sbin/iostat/iostat.c  Thu Jul 09 13:26:52 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iostat.c,v 1.61 2014/06/11 17:01:04 joerg Exp $        */
+/*     $NetBSD: iostat.c,v 1.62 2015/07/09 13:26:52 mrg Exp $  */
 
 /*
  * Copyright (c) 1996 John M. Vinopal
@@ -71,7 +71,7 @@
 #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.62 2015/07/09 13:26:52 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -88,6 +88,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <math.h>
+#include <fnmatch.h>
 
 #include "drvstats.h"
 
@@ -511,7 +512,7 @@
 #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;



Home | Main Index | Thread Index | Old Index