home *** CD-ROM | disk | FTP | other *** search
- #!/bin/csh -f
- #
- # $Id: ddir,v 1.2 93/11/17 14:24:19 carlson Exp $
- #
- # Description:
- # This script will scan a directory and just list those files
- # that are directories.
- #
- # Revision History:
- # $Log: ddir,v $
- # Revision 1.2 93/11/17 14:24:19 carlson
- # Modified to make sure there is a strlen in the path before checking
- # to see if it is executable.
- #
- # Revision 1.1 93/08/20 13:18:38 carlson
- # Initial revision
- #
- # Revision 1.1 1993/02/24 14:12:42 chris
- # Initial revision
- #
- #
- #-----------------------------------------------------------------------
-
- set x = ( `which strlen` )
- if ( $#x > 1 || ! -e $x ) then
- echo "This script requires the program 'strlen' to run."
- exit
- endif
-
- set list = ()
- set i = 0
- foreach file ( * )
- if ( -d $file ) then
- set list = ( $list $file )
- set a = `strlen $file`
- if ( $a > $i ) set i = $a
- endif
- end
-
- if ( $i == 0 ) exit
-
- #----
- # i = Maximum size of word
- # columns = Number of possible columns
- # rows = Number of rows necessary
- #
-
- @ i = $i + 2
- @ columns = 80 / $i
- @ rows = ( $#list / $columns ) + 1
- set format = "%-${i}.${i}s"
-
- @ row = 0
-
- while ( $rows > $row )
- @ column = 0
- while ( $columns > $column )
- @ element = ( $row * $columns ) + $column + 1
- if ( $element <= $#list ) then
- printf "$format" $list[$element]/
- endif
- @ column = $column + 1
- end
- echo ""
- @ row = $row + 1
- end
-