In between releases of MOM, it is necessary to be able to correct bugs. If the number of lines of code needed to correct a bug is significantly smaller than the number of code lines in the file being corrected, then it is more efficient to supply the changes rather than the new file. For example, If file ``changes'' was constructed as
diff -e oldfile newfile > changes
then file ``newfile'' can be constructed from file ``oldfile'' using the following C shell script:
#! /bin/csh -f # update script to build newfile from oldfile using changes which # were generated by diff -e oldfile newfile > changes if ($3 == "") then echo " " echo 'script "update" builds "newfile" from "oldfile" using "changes"' echo "which were generated by diff -e oldfile newfile > changes" echo "->usage: update oldfile changes newfile" exit endif set oldfile = $1 set chgs = $2 set newfile = $3 set work = .temp cat $chgs > $work echo "w $newfile" >> $work echo "q $newfile" >> $work ed $oldfile < $work /bin/rm $work echo "->Done building $newfile from $oldfile + $changes"
If the above script is saved as file ``update'', then the following one-liner will built the ``newfile'' from the ``oldfile'':
update oldfile changes newfile