o Turn the batch mode on if stdout is not tty.
Submitted by: vsevolod MFC after: 1 week
This commit is contained in:
parent
70a14ebe37
commit
62bc2068ec
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=189739
@ -24,7 +24,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd May 20, 2006
|
.Dd March 12, 2009
|
||||||
.Dt GSTAT 8
|
.Dt GSTAT 8
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -47,7 +47,9 @@ The options are as follows:
|
|||||||
.It Fl a
|
.It Fl a
|
||||||
Only display providers that are at least 0.1% busy.
|
Only display providers that are at least 0.1% busy.
|
||||||
.It Fl b
|
.It Fl b
|
||||||
Batch mode. Collect numbers, print and exit.
|
Batch mode.
|
||||||
|
Collect numbers, print and exit.
|
||||||
|
Default if stdout is not a tty.
|
||||||
.It Fl c
|
.It Fl c
|
||||||
Enable display of
|
Enable display of
|
||||||
.Xr geom 4
|
.Xr geom 4
|
||||||
|
@ -99,6 +99,10 @@ main(int argc, char **argv)
|
|||||||
maxx = -1;
|
maxx = -1;
|
||||||
curx = -1;
|
curx = -1;
|
||||||
loop = 1;
|
loop = 1;
|
||||||
|
/* Turn on batch mode if output is not tty. */
|
||||||
|
if (!isatty(fileno(stdout)))
|
||||||
|
flag_b = 1;
|
||||||
|
|
||||||
f_s[0] = '\0';
|
f_s[0] = '\0';
|
||||||
while ((i = getopt(argc, argv, "adcf:I:b")) != -1) {
|
while ((i = getopt(argc, argv, "adcf:I:b")) != -1) {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
@ -318,9 +322,11 @@ main(int argc, char **argv)
|
|||||||
if (!flag_b)
|
if (!flag_b)
|
||||||
attron(COLOR_PAIR(i));
|
attron(COLOR_PAIR(i));
|
||||||
PRINTMSG(" %6.1lf", (double)ld[7]);
|
PRINTMSG(" %6.1lf", (double)ld[7]);
|
||||||
if (!flag_b)
|
if (!flag_b) {
|
||||||
attroff(COLOR_PAIR(i));
|
attroff(COLOR_PAIR(i));
|
||||||
PRINTMSG("|");
|
PRINTMSG("|");
|
||||||
|
} else
|
||||||
|
PRINTMSG(" ");
|
||||||
if (gid == NULL) {
|
if (gid == NULL) {
|
||||||
PRINTMSG(" ??");
|
PRINTMSG(" ??");
|
||||||
} else if (gid->lg_what == ISPROVIDER) {
|
} else if (gid->lg_what == ISPROVIDER) {
|
||||||
|
Loading…
Reference in New Issue
Block a user