Re: Proposed patch - psql wraps at window width - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Proposed patch - psql wraps at window width
Date
Msg-id 200804261344.m3QDi5Y17417@momjian.us
Whole thread Raw
In response to Re: Proposed patch - psql wraps at window width  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Proposed patch - psql wraps at window width
Re: Proposed patch - psql wraps at window width
List pgsql-hackers
Bruce Momjian wrote:
> Gregory Stark wrote:
> I don't see that behavior here on Ubuntu 7.10:
> 
>     $ COLUMNNS=120 ls -C |cat
>     archive       cd    initrd      lost+found  proc  srv  usr
>     basement.usr  dev   initrd.img  media       root  sys  var
>     bin           etc   laptop      mnt         rtmp  tmp  vmlinuz
>     boot          home  lib         opt         sbin  u    win
>     $ ls --version
>     ls (GNU coreutils) 5.97
> 
> That is not a 120 width.  'ls' seems to ignore columns for pipe output.

Oops, Alvaro pointed out I typo'ed the variable name COLUMNS as
COLUMNNS. I see now that 'ls -C' does honor columns.  See my later
posting about '\pset wrapped 0' as a special case where we could honor
the ioctl/COLUMNS case.

My real confusion is this:
$ echo $COLUMNS146
$ ls -C|lessarchive       cd    initrd      lost+found  proc  srv  usrbasement.usr  dev   initrd.img  media       root
sys varbin           etc   laptop      mnt         rtmp  tmp  vmlinuzboot          home  lib         opt         sbin
u   win
 
$ COLUMNS=120 ls -C|lessarchive       bin   cd   etc   initrd      laptop  lost+found  mnt  proc rtmp  srv  tmp  usr
vmlinuzbasement.usr boot  dev  home  initrd.img  lib     media       opt  root sbin  sys  u    var  win
 

Why does the first 'ls' not honor columns while the second does?  How
does 'ls' detect that the COLUMNS=120 is somehow different from the
default COLUMNS value?

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Tech details - psql wraps at window width
Next
From: Alvaro Herrera
Date:
Subject: Re: Re: [COMMITTERS] pgsql: Update: < * Allow adding enumerated values to an existing