H='
==========
exclude [-options] file(s)
==========
delete selected file names and suffixes from the list of names
given in file(s).  if not file is specified, read the standard
input.
==========
OPTIONS
==========
-d  		move to the directory named by the next parameter
-f  		call find to produce a list
-fm 		call find for files more recently modified than next
    		parameter
-fl 		call find for files more recently modified than named log
    		file
-km 		produce a ktree -o nm table
-l	name	process file list in named file
==========
0   exclude temporary files, trash files [default], log files
1   exclude executable files
2   exclude object files
3   exclude library files
4   exclude archive files (*.zoo, *.arc, *.mov, *.tar, *.cpo)
==========
-s  show the exclusion tables
-x  shell execution trace
==========
'
LIST=
F=0
L=
T=
D="."
while	:
do
case $1 in
	-d)		shift;D=$1;;
	-f)		M=$1;;
	-fm)	M=$1;shift;T=$1;;
	-fm)	M=$1;shift;L=$1;;
	-h|-H)	clear;echo "$H" | more ; exit 0;;
	-km)	M=$1;;
	-s)		M=$1;;
	-x)		set -x;;
	[0-9])	F=$1;;
	-[0-9])	clear;echo "$H" | more ; exit 69;;
	-l)		shift;LIST=$1;;
esac
case $# in
	0|1)	break;;
	*)		shift;;
esac
done
F0='
s/[^ ]$/& /
/\/error.[0-9] /d
/\/gdm.[co] /d
/\/\.tabs /d
/\/core /d
/\/a.out /d
/\/nohup.out /d
/\.log /d
/\.tmp /d
'
F1='
/\.x /d
/\.exe /d
'
F2='
/\.o /d
/\.obj /d
'
F3='
/\.lib /d
/\lib.sve /d
'
F4='
/\.zoo /d
/\.mov /d
/\.arc /d
/\.cpo /d
/\.tar /d
'
FX='
/  *$/s///
'
for i in F0 F1 F2 F3 F4
do
case $i in
	F0)	E="$E $F0";;
	F1)	E="$E $F1";;
	F2)	E="$E $F2";;
	F3)	E="$E $F3";;
	F4)	E="$E $F4";;
esac
if test F${F} = $i
then
break
fi
done
E="$E $FX"
cd $D
case $M in
-km)	ktree -d . -o nm | sed -e "$E" | sort ;;
-fl)	find . -type f -newer $L    -print | sed -e "$E" | sort;;
-fm)	find . -type f -mtime -${T} -print | sed -e "$E" | sort;;
-f)		find . -type f -print | sed -e "$E" | sort;;
-s)		echo "$E";exit 0;;
*)		sed -e "$E" $LIST | sort;;
esac
