123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #!/bin/rc
- # flags common to GNU and BSD ls
- # -A all except . and ..
- # -C force mc
- # -F usual
- # -H follow symlinks
- # -L follow symlinks
- # -R recursive list
- # -U unsorted (gnu)
- #
- # -a include .files
- # -c show ctime
- # -d dirs
- # -f no sorting
- # -i inode numbers
- # -l long
- # -p put slash after dir (-F)
- # -r reverse
- # -s sizes
- # -t time sort
- # -u utime
- # -1 single-column
- flagfmt='A,C,F,H,L,R,U,a,c,d,f,i,l,p,r,s,t,u,1'
- args='[file ...]'
- if(! ifs=() eval `{aux/getflags $*}){
- aux/usage
- exit usage
- }
- fn fixlong {
- echo total 1000
- /$cputype/bin/sed 's/^(.).(.........) . [0-9]+ /\1\2 1 /'
- }
- fn qid2inode {
- /$cputype/bin/sed 's/^\(([^ ]+).*\) /\1 /'
- }
- post=cat
- post2=cat
- all=()
- # ignore -A
- if(~ $flagC 1) post=mc
- if(~ $flagF 1) all=($all -F)
- # ignore -H, -L
- # save -R for later
- if(~ $flagU 1) all=($all -n)
- # ignore -a, -c
- if(~ $flagd 1) all=($all -d)
- if(~ $flagf 1) all=($all -n)
- if(~ $flagl 1) { all=($all -l); post=fixlong }
- if(~ $flagi 1) { all=($all -q); post2=qid2inode }
- if(~ $flagp 1) all=($all -F)
- if(~ $flagr 1) all=($all -r)
- if(~ $flags 1) all=($all -s)
- if(~ $flagt 1) all=($all -t)
- if(~ $flagu 1) all=($all -u)
- # ignore -1
- /$cputype/bin/ls $all $* | $post | $post2
|