Index: iostat.c
===================================================================
RCS file: /cvsroot/src/usr.sbin/iostat/iostat.c,v
retrieving revision 1.66
diff -p -u -r1.66 iostat.c
--- iostat.c	9 Sep 2017 23:51:58 -0000	1.66
+++ iostat.c	30 Mar 2018 05:34:47 -0000
@@ -210,14 +210,6 @@ main(int argc, char *argv[])
 		if (todo == 0)
 			errx(1, "no drives");
 	}
-	if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) {
-		lines = ndrives;
-		hdroffset = 3;
-	} else {
-		lines = 1;
-		hdroffset = 4;
-	}
-
 	tv.tv_sec = interval;
 	tv.tv_nsec = 0;
 
@@ -225,6 +217,14 @@ main(int argc, char *argv[])
 	(void)signal(SIGCONT, sig_header);
 
 	for (hdrcnt = 1;;) {
+		if (ISSET(todo, SHOW_STATS_X | SHOW_STATS_Y)) {
+			lines = ndrives;
+			hdroffset = 3;
+		} else {
+			lines = 1;
+			hdroffset = 4;
+		}
+
 		if (do_header || (hdrcnt -= lines) <= 0) {
 			do_header = 0;
 			header();
@@ -244,6 +244,8 @@ main(int argc, char *argv[])
 		nanosleep(&tv, NULL);
 		cpureadstats();
 		drvreadstats();
+
+		ndrives = selectdrives(argc, argv);
 	}
 	exit(0);
 }
