#!/bin/csh -f # # update the patch level of the current CNSsolve distribution # will need to be modified if new directories are added # # Paul Adams May-98 # # copyright Yale University # onintr clean # if ( $#argv != 1 ) then echo "usage: update_patch new-patch-level" exit 1 else if ( $argv[1] == '-help' ) then echo "usage: update_patch new-patch-level" exit 0 else set new_patch=$argv[1] endif # # check that the patch level is a single character ## changed to allow single numbers ATB 6/18/08 # ##if ( $new_patch !~ [A-Za-z] && $new_patch != "0" ) then ## echo update_patch: new level must be a single letter or 0 ## exit 1 ##endif # # update version.inc in source # cd $CNS_SOLVE/source echo "updating files in $CNS_SOLVE/source" foreach file (version.inc) echo "changing patch level for file $file" sed -e "s/CNSPATCH='[0-9,A-Za-z]'/CNSPATCH=\'$new_patch\'/" \ $file > $file.tmp if ( ( ! -z $file.tmp ) && ( `diff $file $file.tmp | wc -l` != 0 ) ) then mv $file.tmp $file else /bin/rm -f $file.tmp endif end # # update main html text file # cd $CNS_SOLVE/doc/html/main echo "updating files in $CNS_SOLVE/doc/html/main" foreach file (text.html) echo "changing patch level for file $file" sed -e "s#Patch level: [0-9,A-Za-z]#Patch level: $new_patch#" \ $file > $file.tmp if ( ( ! -z $file.tmp ) && ( `diff $file $file.tmp | wc -l` != 0 ) ) then mv $file.tmp $file else /bin/rm -f $file.tmp endif end # # update Windows-NT Remember.txt file # #cd $CNS_SOLVE/instlib/machine/supported/windows-nt #echo "updating files in $CNS_SOLVE/instlib/machine/supported/windows-nt" #foreach file (Remember.txt) # echo "changing patch level for file $file" # sed -e "s#Patch level: [0-9,A-Za-z]#Patch level: $new_patch#" \ # $file > $file.tmp # if ( ( ! -z $file.tmp ) && ( `diff $file $file.tmp | wc -l` != 0 ) ) then # mv $file.tmp $file # else # /bin/rm -f $file.tmp # endif #end # # update Readme and Changes file # cd $CNS_SOLVE echo "updating files in $CNS_SOLVE" foreach file (Readme Changes) echo "changing patch level for file $file" sed -e "s#Patch level: [0-9,A-Za-z]#Patch level: $new_patch#" \ $file > $file.tmp if ( ( ! -z $file.tmp ) && ( `diff $file $file.tmp | wc -l` != 0 ) ) then mv $file.tmp $file else /bin/rm -f $file.tmp endif end # exit 0 # clean: /bin/rm -f $file.tmp exit 1 #