tech-userlevel archive

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

systat: ignore/display disks with fnmatc() patterns



I'd like to change systat/disks.c as follows. That way I can ignore
(and add again) disks with shell glob patterns.  E.g:
:ignore md? cgd?
:display [lsw]d?

Comments?

--chris
Index: disks.c
===================================================================
RCS file: /cvsroot/src/usr.bin/systat/disks.c,v
retrieving revision 1.17
diff -u -r1.17 disks.c
--- disks.c     13 Apr 2009 23:20:27 -0000      1.17
+++ disks.c     14 Oct 2013 22:35:53 -0000
@@ -39,6 +39,7 @@
 
 #include <ctype.h>
 #include <string.h>
+#include <fnmatch.h>
 
 #include "systat.h"
 #include "extern.h"
@@ -99,7 +100,7 @@
                if (cp - args == 0)
                        break;
                for (i = 0; i < ndrive; i++)
-                       if (strcmp(args, dr_name[i]) == 0) {
+                       if (fnmatch(args, dr_name[i], 0) == 0) {
                                selections[i] = truefalse;
                                break;
                        }


Home | Main Index | Thread Index | Old Index