#!/bin/csh -f
#
# Gershon Elber, Feb 90.
#

set upcase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
set locase = "abcdefghijklmnopqrstuvwxyz"

echo
echo +++++ Rename directories:
echo
foreach d (`find . -type d -print`)
    set new_d = `echo $d | tr $upcase $locase`

    if ( "$d" != "$new_d" ) then
        echo $d to $new_d
	mv $d $new_d
    endif
end

echo
echo +++++ Rename files, strip CR/LF to LF and remove DOS ^Z:
echo
foreach f (`find . -type f -print`)
    set new_f = `echo $f | tr $upcase $locase`
    echo $f to $new_f

    tr -d "\015\032" < $f > $new_f.tmp
    rm -r $f
    mv $new_f.tmp $new_f
end

#
# Do small fixes manually.
#
(chmod +x dos2unix make-unx test-unx)