#!/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 FAQ FILES README README.MSW \
	lib/CrBufFrI.c lib/CrBufFrP.c lib/CrDatFrI.c \
	lib/CrDatFrP.c lib/CrIFrBuf.c lib/CrIFrDat.c \
	lib/CrPFrBuf.c lib/CrPFrDat.c lib/RdFToDat.c \
	lib/RdFToI.c lib/RdFToP.c lib/WrFFrDat.c \
	lib/WrFFrI.c lib/WrFFrP.c \
	lib/create.c lib/data.c lib/misc.c lib/parse.c \
	lib/rgb.c lib/rgbtab.h lib/scan.c lib/hashtab.c \
	lib/simx.h lib/simx.c lib/xpm.h lib/XpmI.h \
	lib/Attrib.c lib/Image.c lib/Info.c \
	lib/CrIFrP.c lib/CrPFrI.c lib/RdFToBuf.c lib/WrFFrBuf.c \
	namecvt
do
	# fold to lower case
	# so they are fine for DOS, sigh
 	new=`echo $i | tr '[A-Z]' '[a-z]'`
	echo "cp $i fordos/$new" >> cvtux2dos
	echo "cp fromdos/$new new/$i" >> cvtdos2ux
done

# special ones
echo "cp COPYRIGHT fordos/copyrigh.t" >> cvtux2dos
echo "cp fromdos/copyrigh.t new/COPYRIGHT" >> cvtdos2ux
echo "cp doc/xpm.PS.gz fordos/doc/xpm_ps.gz" >> cvtux2dos
echo "cp fromdos/doc/xpm_ps.gz new/doc/xpm.PS.gz" >> cvtdos2ux
#
echo "echo done." >> cvtux2dos
echo "echo done." >> cvtdos2ux

chmod +x cvtux2dos
chmod +x cvtdos2ux

echo "done."
