#
#  This script file should be run after the AMODEM program is run to capture
#  TECOC from a VAX.  It does various cleanup operations on the files so they
#  are ready for use under XENIX.  By having these commands in this script,
#  they can be automatically applied after copying TECOC,  which makes the
#  job of getting TECOC off a VAX a little easier.
#
#  To run this file,  say
#
#	% csh xafter.csh
#
#  Copying files from a VAX using the AMODEM program produces files with names
#  that are in lower case.  The .h files will not be found by the C compiler
#  when the source code is compiled,  because the #include statements in the
#  source code use mixed case.  Rename the files.
#
mv chrfuncs.h ChrFuncs.h
mv defchars.h DefChars.h
mv deferror.h DefError.h
mv defscren.h DefScren.h
mv defteco.h  DefTeco.h
mv zfiles.h   ZFiles.h
mv zport.h    ZPort.h
#
#  Each of the files captured by AMODEM has two extra lines at the bottom.
#  The next set of commands edits each file to remove the lines.
#
#  Create an editor script file that searches for the key string and deletes
#  the line and the line immediately preceeding it.
#
ed <<!
a
1d
/SD0:\[PETE.TECO.TECOC\]/-1,\$d
w
q
.
w edscript
q
!
#
#  Execute the editor script on all *.c files.
#
foreach i (*.c)
echo $i
ed $i <edscript
end
#
#  Execute the editor script on all *.h files.
#
foreach i (*.h)
echo $i
ed $i <edscript
end
#
#  Delete the temporary editor script file
#
rm edscript
