VIEW=more
H='
=========
dscan
=========
executes a shell on the current directory and all of
its sub directories.
=========
'
PS1="(dscan): "
export PS1
LX=-Cs
OX='(cd $d;ls $LX|$VIEW;sh -i)'
while   :
do
    case $1 in
        -x)             set -x;;
        -h|help|hint)   clear;echo "$H";exit 0;;
        -e)             OX='(cd $d;$VIEW error.*;sh -i)';;
        -s)             LX=-Cs;;
        -l)             LX=-l;OX='(cd $d;ls $LX|$VIEW;sh -i)';;
		*)				break;;
    esac
    case $# in
        0)  break;;
        1)  break;;
        *)  shift;;
    esac
done
:
case $# in
	0)	D=`find . -type d -print | sort -r`;;
	*)	D=`find $@ -type d -print | sort -r`;;
esac
:
BASE=`pwd`
BARF=`echo -n`
case $BARF in
	-n)	BARF='\c';;
	*)	BARF="-n";;
esac
:
for d in $D
do
trap 'echo INTERRUPT;' 2 3 4 14
if test ! -d $d
then
echo "($0) <not found> $d"
continue
fi
echo "$BARF" "($0) $d? "
read X
case $X in
    x*) cd $BASE;exit 0;;
    n*) continue;;
    *)  ;;
esac
eval $OX
done
