Re: [dev] [sbase] [PATCH] ls fallback if ioctl does not work

2015-02-15 Thread Dimitris Papastamos
On Sun, Feb 15, 2015 at 07:48:58PM +0100, k...@shike2.com wrote: > > On Sun, 15 Feb 2015 19:35:51 +0100 > > k...@shike2.com wrote: > > > >> I like your solution, but I think COLUMNS should have a bigger > >> priority, because in this case user can define a different value of > >> the current width

Re: [dev] [sbase] [PATCH] ls fallback if ioctl does not work

2015-02-15 Thread k0ga
> On Sun, 15 Feb 2015 19:35:51 +0100 > k...@shike2.com wrote: > >> I like your solution, but I think COLUMNS should have a bigger >> priority, because in this case user can define a different value of >> the current width. > > Okay, then do 3 fallbacks > > ioctl -> getenv -> fixed width > Ups,

Re: [dev] [sbase] [PATCH] ls fallback if ioctl does not work

2015-02-15 Thread FRIGN
On Sun, 15 Feb 2015 19:35:51 +0100 k...@shike2.com wrote: > I like your solution, but I think COLUMNS should have a bigger > priority, because in this case user can define a different value of > the current width. Okay, then do 3 fallbacks ioctl -> getenv -> fixed width -- FRIGN

Re: [dev] [sbase] [PATCH] ls fallback if ioctl does not work

2015-02-15 Thread Dimitris Papastamos
On Sun, Feb 15, 2015 at 07:35:51PM +0100, k...@shike2.com wrote: > > > The ioctl() can be assumed to be present on all systems, but in case > > TIOCGWINSZ doesn't exist, we fall back to the fixed value. This is the > > best of both worlds. > > > > I like your solution, but I think COLUMNS should

Re: [dev] [sbase] [PATCH] ls fallback if ioctl does not work

2015-02-15 Thread k0ga
> The ioctl() can be assumed to be present on all systems, but in case > TIOCGWINSZ doesn't exist, we fall back to the fixed value. This is the > best of both worlds. > I like your solution, but I think COLUMNS should have a bigger priority, because in this case user can define a different value

Re: [dev] [sbase] [PATCH] ls fallback if ioctl does not work

2015-02-15 Thread Ralph Eastwood
On 15 February 2015 at 16:50, wrote: > You can trust the value of COLUMNS. I think this is the correct way > programs must detect the size of the terminal. Unfortunately, this is the first thing I tried - and I found that the variable isn't actually exported. So short of running export COLUMNS;

Re: [dev] [sbase] [PATCH] ls fallback if ioctl does not work

2015-02-15 Thread FRIGN
On Sun, 15 Feb 2015 17:50:19 +0100 k...@shike2.com wrote: > You can trust the value of COLUMNS. I think this is the correct way > programs must detect the size of the terminal. The stress is _portably_. Quoting ioctl(2) manpage: CONFORMING TO No single standard. Arguments, returns, and s

Re: [dev] [sbase] [PATCH] ls fallback if ioctl does not work

2015-02-15 Thread k0ga
> As per discussion on IRC with FRIGN, ioctl is no standard, but it is > probably a defacto standard; how else can you determine the terminal > width portably? However, this patch adds a fallback in case you can't > read the terminal width - this is how cols currently does it. You can trust the v