MFC rev. 1.36: with -x switch do not pay attention at the hardcoded

limit of 3 devices and dump stats for all devices in the system.
This commit is contained in:
maxim 2007-08-17 19:09:00 +00:00
parent 48e284ac69
commit bd43b633df

View File

@ -281,11 +281,17 @@ main(int argc, char **argv)
Tflag = 1;
}
/* find out how many devices we have */
if ((num_devices = devstat_getnumdevs(kd)) < 0)
err(1, "can't get number of devices");
/*
* Figure out how many devices we should display.
*/
if (nflag == 0) {
if (oflag > 0) {
if (xflag > 0)
maxshowdevs = num_devices;
else if (oflag > 0) {
if ((dflag > 0) && (Cflag == 0) && (Tflag == 0))
maxshowdevs = 5;
else if ((dflag > 0) && (Tflag > 0) && (Cflag == 0))
@ -300,10 +306,6 @@ main(int argc, char **argv)
}
}
/* find out how many devices we have */
if ((num_devices = devstat_getnumdevs(kd)) < 0)
err(1, "can't get number of devices");
cur.dinfo = (struct devinfo *)malloc(sizeof(struct devinfo));
if (cur.dinfo == NULL)
err(1, "malloc failed");