# Edit files used in marking and getting.
# The files get332.tpl, markall.tpl, file1.tpl, install.tpl,
# and versions.tpl are template files which have the semaphore
# 'xx.yyzz template nn' embedded in them so that a search and replace can
# be easily done.
#echo Syntax: editfile 2 2 a B386 0
#pause

#
# make sure there's the right number of arguments
if test $# -ne 5
then
   echo $#
   echo editfile major minor bug string build
   exit 1
fi

# edit get332.bat markall.bat marktest.bat
# Uses get332.tpl, marktest.tpl and markall.tpl for making the changes
cd s:/tbird/m332
rm editfile.log
get -y -l get332.bat
get -y -l markall.bat
get -y get332.tpl
get -y markall.tpl
sed "s/xx.yyzz/pv $1.$2$3 $4.$5/" < get332.tpl > get332.bat
sed "s/xx.yyzz/pv $1.$2$3 $4.$5/" < markall.tpl > markall.bat
put -m"pv $1.$2$3 $4 build $5" get332.bat markall.bat

# cd s:/tbird/m332/test
# get -y -l marktest.bat
# get -y -w marktest.tpl
# sed "s/xx.yyzz/pv $1.$2$3/" < marktest.tpl > marktest.bat
# put -y -m"pv $1.$2$3" marktest.bat >> s:/tbird/m332/editfile.log

# edit file1.lis
# Uses file1.tpl for making the changes
cd s:/tbird/m332/install/disk1
get -y -l file1.lis 
get -y -w file1.tpl
sed "s/xx.yyzz/$1.$2$3/" < file1.tpl > file1.lis
put -y -m"pv $1.$2$3 $4 build $5" file1.lis >> s:/tbird/m332/editfile.log

# edit install.rul
# Uses install.tpl for making the changes
cd s:/tbird/m332/install
get -y -l install.rul 
get -y -w install.tpl
sed "s/xx.yyzz/$1.$2$3/" < install.tpl > install.rul
put -y -m"pv $1.$2$3 $4 build $5" install.rul >> s:/tbird/m332/editfile.log

# edit lanservr.rul
# Uses lanservr.tpl for making the changes
cd s:/tbird/m332/install/lanservr
get -y -l lanservr.rul 
get -y -w lanservr.tpl
sed "s/xx.yyzz/$1.$2$3/" < lanservr.tpl > lanservr.rul
put -y -m"pv $1.$2$3 $4 build $5" lanservr.rul >> s:/tbird/m332/editfile.log

# edit pcnfs.rul
# Uses pcnfs.tpl for making the changes
cd s:/tbird/m332/install/pcnfs
get -y -l pcnfs.rul 
get -y -w pcnfs.tpl
sed "s/xx.yyzz/$1.$2$3/" < pcnfs.tpl > pcnfs.rul
put -y -m"pv $1.$2$3 $4 build $5" pcnfs.rul >> s:/tbird/m332/editfile.log

# edit versions.h
# Uses versions.tpl for making the changes
cd s:/tbird/m332/inc
get -y -w versions.tpl
get -y -l versions.h
sed -e "s/xx/$1/" -e "s/yy/$2/" -e "s/zz/$3/" -e "s/template/$4/" -e "s/nn/$5/" < versions.tpl > versions.h
put -y -m"pv $1.$2$3 $4 build $5" versions.h >> s:/tbird/m332/editfile.log
