#!/bin/sh
#
# create two scripts to convert the filenames of the XPM distribution
# run this in the xpm toplevel directory
# after that you have the following two scripts
# cvtux2dos will copy the files into fordos/
# cvtdos2ux will copy from fromdos/ to new/
#
# Written by HeDu 5/94 (hedu@cul-ipn.uni-kiel.de)
#

echo "Making cvtux2dos and cvtdos2ux..."

cp /dev/null cvtux2dos
echo "#!/bin/sh" > cvtux2dos
echo "echo Making dos hierarchy..." >> cvtux2dos
echo "mkdir fordos" >> cvtux2dos
echo "mkdir fordos/lib" >> cvtux2dos
echo "mkdir fordos/doc" >> cvtux2dos

cp /dev/null cvtdos2ux
echo "#!/bin/sh" > cvtdos2ux
echo "echo Making unix hierarchy..." >> cvtdos2ux
echo "mkdir new" >> cvtdos2ux
echo "mkdir new/lib" >> cvtdos2ux
echo "mkdir new/doc" >> cvtdos2ux

for i in CHANGES FILES README README.MSW \
	lib/XpmCrBufFrI.c lib/XpmCrBufFrP.c lib/XpmCrDataFrI.c \
	lib/XpmCrDataFrP.c lib/XpmCrIFrBuf.c lib/XpmCrIFrData.c \
	lib/XpmCrPFrBuf.c lib/XpmCrPFrData.c lib/XpmRdFToData.c \
	lib/XpmRdFToI.c lib/XpmRdFToP.c lib/XpmWrFFrData.c \
	lib/XpmWrFFrI.c lib/XpmWrFFrP.c \
	lib/create.c lib/data.c \
	lib/misc.c lib/parse.c \
	lib/rgb.c lib/rgbtab.h lib/scan.c \
	lib/simx.h lib/simx.c lib/xpm.h \
	lib/xpmP.h \
	doc/xpm.ps \
	namecvt
do
	# remove Xpm, shorten Data to dat and fold to lower case
	# so they are fine for DOS, sigh
 	new=`echo $i | sed 's/Xpm//' | sed 's/Data/dat/' | tr '[A-Z]' '[a-z]'`
	echo "cp $i fordos/$new" >> cvtux2dos
	echo "cp fromdos/$new new/$i" >> cvtdos2ux
done

# special one
echo "cp COPYRIGHT fordos/copyrigh.t" >> cvtux2dos
echo "cp fromdos/copyrigh.t new/COPYRIGHT" >> cvtdos2ux
echo "cp lib/hashtable.c fordos/lib/hashtab.c" >> cvtux2dos
echo "cp fromdos/lib/hashtab.c new/lib/hashtable.c" >> cvtdos2ux

#
echo "echo done." >> cvtux2dos
echo "echo done." >> cvtdos2ux

chmod +x cvtux2dos
chmod +x cvtdos2ux

echo "done."
