#! /bin/csh
#	This is the script from the wwwwais page
set rootdir = /usr/local/www
#	This is the root directory of the Web tree you want to index.

set index = /usr/local/httpd/wais/sources/index
#	This is the name your WAIS indexes will be built under.
#       Index files will be called index.* in the /usr/local/httpd/wais/sources
#       directory, in this example.

set indexprog = /usr/local/httpd/wais/waisindex
#	The full pathname to your waisindex program.

set nonomatch
cd $rootdir
set num = 0
foreach pathname (`du $rootdir | cut -f2 | tail -r`)

	echo "The current pathname is: $pathname"
	if ($num == 0) then
		set exportflag = "-export"
	else
		set exportflag = "-a"
	endif
        $indexprog -l 0 -nopairs -nocat -d $index $exportflag $pathname/*.html
        $indexprog -l 0 -nopairs -nocat -d $index -a $pathname/*.txt
        $indexprog -l 0 -nopairs -nocat -d $index -a $pathname/*.c
        $indexprog -nocontents -l 0 -nopairs -nocat -d $index -a $pathname/*.ps
        $indexprog -nocontents -l 0 -nopairs -nocat -d $index -a $pathname/*.gif
        $indexprog -nocontents -l 0 -nopairs -nocat -d $index -a $pathname/*.au
        $indexprog -nocontents -l 0 -nopairs -nocat -d $index -a $pathname/*.hqx
        $indexprog -nocontents -l 0 -nopairs -nocat -d $index -a $pathname/*.xbm
        $indexprog -nocontents -l 0 -nopairs -nocat -d $index -a $pathname/*.mpg
        $indexprog -nocontents -l 0 -nopairs -nocat -d $index -a $pathname/*.pict
        $indexprog -nocontents -l 0 -nopairs -nocat -d $index -a $pathname/*.tiff
	@ num++
end
echo "$num directories were indexed."
