Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2008 17:30:04 GMT
From:      Maxim Konovalov <maxim@macomnet.ru>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/119705: [PATCH] make iostat a bit smarter about the number of tty rows
Message-ID:  <200801161730.m0GHU4i4000110@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/119705; it has been noted by GNATS.

From: Maxim Konovalov <maxim@macomnet.ru>
To: Giorgos Keramidas <keramida@freebsd.org>
Cc: Bruce Evans <bde@freebsd.org>, bug-followup@freebsd.org
Subject: Re: bin/119705: [PATCH] make iostat a bit smarter about the number
 of tty rows
Date: Wed, 16 Jan 2008 20:28:46 +0300 (MSK)

 On Wed, 16 Jan 2008, 09:41+0200, Giorgos Keramidas wrote:
 
 > On 2008-01-16 09:39, Giorgos Keramidas <keramida@freebsd.org> wrote:
 > > Both fixed, I think.  The new version of the patch is attached below,
 > > after the following changes:
 > >
 > >   * Reset wresized when doresize() completes its work
 > >   * Only call isatty(fileno(stdout)) once, instead of every time
 > >   doresize() is called
 > >   * Only install a SIGWINCH handler if isatty() is true
 > > diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
 > > --- a/usr.sbin/iostat/iostat.c
 > > +++ b/usr.sbin/iostat/iostat.c
 > [...]
 > > @@ -426,6 +433,20 @@ main(int argc, char **argv)
 > >  	 */
 > >  	(void)signal(SIGCONT, needhdr);
 > >
 > > +	/*
 > > +	 * If our standard output is a tty, then install a SIGWINCH handler
 > > +	 * and set wresized so that our first iteration through the main
 > > +	 * iostat loop will peek at the terminal's current rows to find out
 > > +	 * how many lines can fit in a screenful of output.
 > > +	 */
 > > +	if (isatty(fileno(stdout)) != 0) {
 > > +		wresized = 1;
 > > +		(void)signal(SIGWINCH, needresize);
 > > +	} else {
 > > +		wrows = IOSTAT_DEFAULT_ROWS;
 > > +		return;
 >
 > Oops.  `return' doesn't belong here, of course.  Running iostat | more
 > caught what I missed :)
 >
 Looks OK to me.
 
 -- 
 Maxim Konovalov



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801161730.m0GHU4i4000110>