"Peter Eisentraut" <peter_e@gmx.net> writes:
> Bruce Momjian wrote:
>> I checked the use of COLUMNS and it seems bash updates the environment
>> variable when a window is resized. I added ioctl(TIOCGWINSZ) if COLUMNS
>> isn't set. We already had a call in print.c for detecting the
>> number of rows on the screen to determine if the pager should
>> be used. Seems COLUMNS should take precedence over ioctl(), right?
>
> Considering that the code to determine the row count is undisputed so far, the
> column count detection should work the same. That is, we might not need to
> look at COLUMNS at all. Unless there is a use case for overriding the column
> count (instead of just turning off the wrapping).
I do that all the time. I normally am running under an emacs terminal so I
don't know what width the ioctl's going to get back but it's unlikely to be
right. In any case I may want to format the output to a width narrower than
the window because I'm going to narrow it.
Also, how would you suggest figuring the width to use for output going to a
file? ioctl is irrelevant in that case, imho it should just default to 80
columns if COLUMNS is unset.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's Slony Replication support!