#!/bin/sh
# Tools to convert data area from gopher to gopher+
# Mar93	- Mitra		First version

# Must run this from top level of gopher area, or at least of 
# the directory tree you want converted
#set -x
umask 002		# Stop "others" writing, but otherwise readable
HomeDir=`pwd`
 find $HomeDir -name ".IndexLink" -print | 
	while read line
	do
		echo $line
		cd `dirname $line`
		mv .IndexLink .WaisIndex
	done
find $HomeDir -name ".cap" -print |
while read line		# Gets full path 
do
	echo $line
	cd $line
	rm -f ../.names
	for i in *
	do
	    if [ -f ../$i -o -d ../$i -o -f ../$i.Z ]
	    then
		echo "${i};" >&2
		case "$i" in
		*gif)	Prefix=`echo $i | sed -e 's/\.[a-z]*$//'`
			echo "Path=~/$Prefix" ;;
		*) 	echo "Path=~/$i" ;;
		esac
		cat $i
		echo "#"	
	    else
		ThisDir=`pwd`
		echo "`dirname $ThisDir`/$i no longer exists" >&2
	    fi
 	done >>../.names
done