le.c
Peter da Silva
peter at baylor.UUCP
Thu Aug 22 05:05:15 AEST 1985
le is an extended ls, designed to please all the people who want to get
weird info on a file. It dumps reliable info in reliable positions, for
example it won't stick the major/minor device #s in the file size feild
of the output. Let me see about the options...
Without any flags it outputs the same info as ls...
Usage: le [-A|-N] [-diMmlUuGgrsatc] [-Ttab] [-Hh] [-D] [file]...
-d Toggle 'dev' flag.
-i Toggle 'inode' flag.
-m Toggle 'mode' flag.
-M Toggle 'short mode' (octal mode) flag.
-l Toggle 'links' flag.
-u Toggle 'user' flag.
-U Toggle 'short user' (userid) flag.
-g Toggle 'group' flag.
-G Toggle 'short group' (groupid) flag.
-r Toggle 'rdev' flag.
-s Toggle 'size' flag.
-a Toggle 'atime' flag.
-t Toggle 'mtime' flag.
-c Toggle 'ctime' flag.
-h Toggle header.
-H Force output of the header.
-N (No) Clear all flags.
-A (All) Set all flags.
-D Dont list directories (like ls -d).
-Ttab Use the string 'tab' to seperate feilds instead of space.
The flags can be included in any order but having any of
[dimMluUgGrsatc] before [AN] is kind of useless, and having [Hh]
before [dimMluUgGrsatc] can be misleading. You can intersperse
options with files if you want to list different directories
differently. I don't see any reason to do this but I also see no
good reason to prevent this (no, I don't use getopt).
As an example: here is 'ls -al' compared with 'le'
Note that feild 7 varies between a time and a year, and that 4 varies
between a size and a device #... while this is more useful for humans
it's kind of hard on awk... le isn't a replacement for 'ls', just for
ls in shell scripts so you can keep awk and relatives happy.
% ls -al /dev
total 4
c-w--w--w- 2 root 5, 0 Aug 21 13:46 aux1
c-w--w--w- 2 root 5, 1 May 20 09:50 aux2
crw--w--w- 1 root 0, 8 Aug 20 13:52 console
...
crw-rw-rw- 1 root 1, 23 Aug 18 1982 hsix7
crw------- 1 root 2, 1 Aug 20 13:52 kmem
-rw-rw-r-- 1 root 1635 Jul 11 17:39 lp
c-w--w--w- 2 root 5, 0 Aug 21 13:46 lp1
c-w--w--w- 2 root 5, 1 May 20 09:50 lp2
...
crw--w--w- 1 root 0, 15 Jul 23 15:38 tty7
% le /dev
drwxr-xr-x 2 root 928 11 Jul 85 16:40 /dev/.
drwxr-xr-x 11 root 368 20 Aug 85 13:52 /dev/..
c-w--w--w- 2 root 0 21 Aug 85 13:46 /dev/aux1
c-w--w--w- 2 root 0 20 May 85 9:50 /dev/aux2
crw--w--w- 1 root 0 20 Aug 85 13:52 /dev/console
...
crw-rw-rw- 1 root 0 18 Aug 82 11:11 /dev/hsix7
crw------- 1 root 0 20 Aug 85 13:52 /dev/kmem
-rw-rw-r-- 1 root 1635 11 Jul 85 17:39 /dev/lp
c-w--w--w- 2 root 0 21 Aug 85 13:46 /dev/lp1
c-w--w--w- 2 root 0 20 May 85 9:50 /dev/lp2
...
crw--w--w- 1 root 0 23 Jul 85 15:38 /dev/tty7
There is a problem: le expands control characters to '^X', which may cause
problems in some cases... le -N is thus not exactly the equivalent of ls -A.
This code can be easily changed if this proves a problem. Don't ask me why
/dev/lp is a regular file, I didn't create it... :-> Time to go do some sa-type
stuff.
--
Peter (Made in Australia) da Silva
UUCP: ...!shell!neuro1!{hyd-ptd,baylor,datafac}!peter
MCI: PDASILVA; CIS: 70216,1076
More information about the Comp.sources.unix
mailing list