Many users needlessly maintain the alias 'l' (or 'll') for 'ls -l'. We

should ease the burden on our users and supply a default system which is
modern and has a full complement of the features they expect (or even some
they don't -- more features don't hurt any one after all).

Suggested by perry@ in <87wt2uxhbx.fsf@snark.piermont.com> and submitted
for discussion to some NetBSD developers, who suggested that rather than
my own idiosyncratic 'll', 'l' was a much better name.

It may prove possible to merge this code with 'ls' in the future.
This commit is contained in:
tls 2007-02-07 21:56:07 +00:00
parent d6cabf29ac
commit de788b88f5
11 changed files with 58 additions and 43 deletions

View File

@ -1,8 +1,8 @@
# $NetBSD: Makefile,v 1.19 2002/06/17 16:29:07 christos Exp $
# $NetBSD: Makefile,v 1.20 2007/02/07 21:56:07 tls Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
SUBDIR= cat chio chmod cp csh date dd df domainname echo ed expr hostname \
kill ksh ln ls mkdir mt mv pax ps pwd rcp rcmd rm rmdir sh \
kill ksh l ln ls mkdir mt mv pax ps pwd rcp rcmd rm rmdir sh \
sleep stty sync systrace test
.include <bsd.subdir.mk>

View File

@ -1,10 +1,8 @@
# @(#)Makefile 8.1 (Berkeley) 6/2/93
# $Id: Makefile,v 1.1.1.1 2007/02/07 21:43:44 tls Exp $
#
# $NetBSD: Makefile,v 1.2 2007/02/07 21:56:08 tls Exp $
PROG= colorls
PROG= l
SRCS= cmp.c stat_flags.c ls.c print.c util.c
BINDIR= ${PREFIX}/bin
MANDIR= ${PREFIX}/man
MANINSTALL= catinstall maninstall
.include <bsd.prog.mk>

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cmp.c,v 1.1.1.1 2007/02/07 21:43:44 tls Exp $
* $Id: cmp.c,v 1.2 2007/02/07 21:56:08 tls Exp $
*/
#ifndef lint

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)extern.h 8.1 (Berkeley) 5/31/93
* $Id: extern.h,v 1.1.1.1 2007/02/07 21:43:44 tls Exp $
* $Id: extern.h,v 1.2 2007/02/07 21:56:08 tls Exp $
*/
int acccmp __P((const FTSENT *, const FTSENT *));

View File

@ -33,38 +33,31 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)ls.1 8.7 (Berkeley) 7/29/94
.\" $Id: ls.1,v 1.1.1.1 2007/02/07 21:43:44 tls Exp $
.\" FreeBSD Id: ls.1,v 1.6 1996/12/14 06:03:27 steve Exp $
.\" $NetBSD: l.1,v 1.1 2007/02/07 21:56:08 tls Exp $
.\"
.Dd July 29, 1994
.Dt COLORLS 1
.Dd February 7, 2007
.Dt L 1
.Os
.Sh NAME
.Nm colorls
.Nd list directory contents in color
.Nm l
.Nd list directory contents, long-form, in color
.Sh SYNOPSIS
.Nm colorls
.Nm l
.Op Fl ACFGLRTWacdfiloqrstu1
.Op Ar file ...
.Sh DESCRIPTION
(Note: This man page describes the color version of the program. To
minimize the differences from the original, the program is referred to
as
.Nm ls
in this manual. The new option
.Fl G
is for color display.)
.Pp
For each operand that names a
.Ar file
of a type other than
directory,
.Nm ls
.Nm l
displays its name as well as any requested,
associated information.
For each operand that names a
.Ar file
of type directory,
.Nm ls
.Nm l
displays the names of files contained
within that directory, as well as any requested, associated
information.
@ -85,7 +78,7 @@ and
.Ql \&.. .
Always set for the super-user.
.It Fl C
Force multi-column output; this is the default when output is to a terminal.
Force multi-column output.
.It Fl F
Display a slash (/) immediately after each pathname
that is a directory, an asterisk (*) after each that is
@ -100,7 +93,9 @@ Use ANSI color sequences to distinguish file types. (See
.Ev LSCOLORS
below.) In addition to those mentioned above in
.Fl F ,
some extra attributes (setuid bit set, etc.) are also displayed.
some extra attributes (setuid bit set, etc.) are also displayed. This is
the default regardless of whether or not output is a terminal (never mind
what type of terminal).
.It Fl L
If argument is a symbolic link, list the file or directory the link references
rather than the link itself.
@ -129,7 +124,7 @@ not blocks.
.It Fl l
(The lowercase letter ``ell.'') List in long format. (See below.)
If the output is to a terminal, a total sum for all the file
sizes is output on a line before the long listing.
sizes is output on a line before the long listing. This is the default.
.It Fl o
Include the file flags in a long
.Pq Fl l
@ -179,9 +174,9 @@ options override each other; the last one specified determines
the file time used.
.Pp
By default,
.Nm ls
.Nm l
lists one entry per line to standard
output; the exceptions are to terminals or when the
output; the exception is when the
.Fl C
option is specified.
.Pp
@ -302,11 +297,11 @@ or
.El
.Pp
The
.Nm ls
.Nm l
utility exits 0 on success, and >0 if an error occurs.
.Sh ENVIRONMENTAL VARIABLES
The following environment variables affect the execution of
.Nm ls :
.Nm l :
.Bl -tag -width BLOCKSIZE
.It Ev BLOCKSIZE
If the environmental variable
@ -321,7 +316,7 @@ decimal integer, it is used as the
column position width for displaying
multiple-text-column output.
The
.Nm ls
.Nm l
utility calculates how
many pathname text columns to display
based on the width provided.
@ -412,12 +407,28 @@ specification.
.Xr sticky 8
.Sh HISTORY
An
.Nm l
alias appeared in a future NetBSD developer's
.Pa \&.cshrc
in the mid-1980s. Cursory research
indicates that this vital system feature is even
older than that.
.Sh FUTUREHISTORY
According to some NetBSD developers, only with color
.Nm ls
command appeared in
.At v1 .
will NetBSD take back the desktop. The default output of
.Nm l
is much longer than that of other color
.Nm ls
programs, so with
.Nm l ,
NetBSD will take back the desktop much more.
.Sh STANDARDS
The
.Nm ls
.Nm l
function is expected to be a superset of the
.St -p1003.2
specification.
.Nm ls
specification. If you want to run
.At v7 ,
though, it is available for download.

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ls.c,v 1.1.1.1 2007/02/07 21:43:44 tls Exp $
* $Id: ls.c,v 1.2 2007/02/07 21:56:08 tls Exp $
*/
#ifndef lint
@ -132,6 +132,11 @@ main(argc, argv)
termwidth = atoi(p);
}
/* If you want v7, you know where to find it. */
f_color = 1;
f_longform = 1;
f_column = f_singlecol = 0;
/* Root is -A automatically. */
if (!getuid())
f_listdot = 1;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)ls.h 8.1 (Berkeley) 5/31/93
* $Id: ls.h,v 1.1.1.1 2007/02/07 21:43:44 tls Exp $
* $Id: ls.h,v 1.2 2007/02/07 21:56:08 tls Exp $
*/
#define NO_PRINT 1

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: print.c,v 1.1.1.1 2007/02/07 21:43:46 tls Exp $
* $Id: print.c,v 1.2 2007/02/07 21:56:08 tls Exp $
*/
#ifndef lint

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: stat_flags.c,v 1.1.1.1 2007/02/07 21:43:47 tls Exp $
* $Id: stat_flags.c,v 1.2 2007/02/07 21:56:08 tls Exp $
*/
#ifndef lint

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: util.c,v 1.1.1.1 2007/02/07 21:43:47 tls Exp $
* $Id: util.c,v 1.2 2007/02/07 21:56:08 tls Exp $
*/
#ifndef lint

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.685 2007/01/30 19:40:08 elad Exp $
# $NetBSD: mi,v 1.686 2007/02/07 21:56:07 tls Exp $
. base-sys-root
./altroot base-sys-root
./bin base-sys-root
@ -19,6 +19,7 @@
./bin/hostname base-util-root
./bin/kill base-util-root
./bin/ksh base-util-root
./bin/l base-util-root
./bin/ln base-util-root
./bin/ls base-util-root
./bin/mkdir base-util-root