Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/iostat Fix processing of the archaic arg format (BA...



details:   https://anonhg.NetBSD.org/src/rev/df0d08a36b92
branches:  trunk
changeset: 366810:df0d08a36b92
user:      kre <kre%NetBSD.org@localhost>
date:      Fri Jun 17 01:47:45 2022 +0000

description:
Fix processing of the archaic arg format (BACKWARD_COMPATIBILITY) so it
doesn't repeat the processing every iteration.  Repeatedly seeing the wait
interval does no harm, but setting the iteration count (reps) over and
over again rather defeats its purpose.

diffstat:

 usr.sbin/iostat/iostat.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (63 lines):

diff -r b1db1fd9dba2 -r df0d08a36b92 usr.sbin/iostat/iostat.c
--- a/usr.sbin/iostat/iostat.c  Thu Jun 16 21:24:41 2022 +0000
+++ b/usr.sbin/iostat/iostat.c  Fri Jun 17 01:47:45 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iostat.c,v 1.67 2018/04/08 11:37:31 mlelstv Exp $      */
+/*     $NetBSD: iostat.c,v 1.68 2022/06/17 01:47:45 kre 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.67 2018/04/08 11:37:31 mlelstv Exp $");
+__RCSID("$NetBSD: iostat.c,v 1.68 2022/06/17 01:47:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -124,7 +124,7 @@
 static void header(void);
 __dead static void usage(void);
 static void display(void);
-static int selectdrives(int, char *[]);
+static int selectdrives(int, char *[], int);
 
 int
 main(int argc, char *argv[])
@@ -203,7 +203,7 @@
        drvinit(0);
        cpureadstats();
        drvreadstats();
-       ndrives = selectdrives(argc, argv);
+       ndrives = selectdrives(argc, argv, 1);
        if (ndrives == 0) {
                /* No drives are selected.  No need to show drive stats. */
                todo &= ~SHOW_STATS_ALL;
@@ -245,7 +245,7 @@
                cpureadstats();
                drvreadstats();
 
-               ndrives = selectdrives(argc, argv);
+               ndrives = selectdrives(argc, argv, 0);
        }
        exit(0);
 }
@@ -614,7 +614,7 @@
 }
 
 static int
-selectdrives(int argc, char *argv[])
+selectdrives(int argc, char *argv[], int first)
 {
        int     i, maxdrives, ndrives, tried;
 
@@ -663,7 +663,7 @@
        }
 
 #ifdef BACKWARD_COMPATIBILITY
-       if (*argv) {
+       if (first && *argv) {
                interval = atoi(*argv);
                if (*++argv)
                        reps = atoi(*argv);



Home | Main Index | Thread Index | Old Index