home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl4.036
- #
- # Copyright Martin Leisner leisner@sdsp.mc.xerox.com
- # $Id$
-
- $directory=".";
- $print_directory=0;
- $format_string="%3s %2s %-10s%8s %s/%s\n";
- while(<>) {
- chop;
- if(length == 0) {
- next; # nothing to process
- }
- @line = split;
- if($#line == -1 ) {
- # error ? newline?
- next;
- }
-
- if($#line == 0) {
- chop;
- $directory = $_;
- $print_directory=0;
- next;
- } elsif($#line == 1) {
- # skip this line
- next;
- } elsif(substr($_,0,1) eq "d") {
- # print "skipping directory\n";
- next;
- } elsif(substr($_,0,1) eq "l") {
- # ignore links?
- next
- }
-
- if($print_directory == 0) {
- printf "\n%s\n", $directory;
- $print_directory=1;
- }
-
-
- if($#line == 8) {
- # have group?
- printf $format_string,
- $line[5], $line[6], $line[7], $line[4],
- $directory, $line[8];
- } elsif($#line == 7) {
- # no group
- printf $format_string, $line[4], $line[5], $line[6],
- $line[3], $directory, $line[7];
- } else {
- printf "line wrong number of elements = %d\n", $#line;
- die;
- }
- }
-