instability in Berkeley versus AT&T releases (absurdly long)

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Fri Aug 9 09:40:21 AEST 1985


> > > The only thing terrible about ls -C is that it ought to be the default for
> > > CRTs. USG ls _requires_ the "-C" to get the multiple columns, which _is_
> > > brain damaged.
> > 
> > I would sure get upset if when I ran "ls" in the long skinny window
> > on my DMD, it didn't print the file names one per line.  You are
> > making the same mistake that a lot of the more crufty BSD software
> > has made, namely:  assuming an overly-restrictive model of how the
> > software is to be used.
> 
> Actually, the SVR2 ls -C looks at the COLUMNS variable to find out how much
> space is available, and adjusts the number of columns accordingly.
> The 4.1BSD ls checked whether isatty(stdout), and set the output to single or
> multi-column accordingly; I always hated that since I normally wanted
> multi-column all the time.

Columnators should also do an ioctl(TIOCGWINSZ) or the DMD equivalent.
Our "mpx" does not alter the COLUMNS environment variable for each
layer, but rather stores the window size in the tty structure.

Actually, if you want columnated "ls", given the way "ls" works it
is necessary to either build the columnation into "ls" or to provide
a very specific columnizing filter, since "ls" lists multiple
directories WITH HEADERS so that simple-minded columnizing will mess
up the output.  I think the SVR2 method (requiring an explicit request
for columnation) is preferable to Berkeley's automatic behavior.  It is
very easy to make up a shell function, alias, or script like
	l(){
	ls -Cf $*;
	}
to make your own personalized "l" command if you want one.

Default command behavior should be simple, with complexities reserved
for the options.

P.S.  I think I started the "ls" debate, but all I said was that I
thought "ls -[a-z][A-Z]" was yucky (too many options to remember).
I don't like a directory-entry listing utility having to know about
terminal characteristics, though.  This seems like an unnecessary
combining of function.  I like Peter Weinberger's idea of having a
directory format that is directly printable:
	10038	.
	10039	..
	10502	myfile
	10501	mydir
etc.  It would even be nice to get rid of . and ..  I guess it's too late...



More information about the Comp.unix.wizards mailing list