[brlcad-commits] CVS: brlcad/sh copyright.sh,14.13,14.14
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: Sean M. <br...@us...> - 2007-01-20 21:26:10
|
Update of /cvsroot/brlcad/brlcad/sh In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23991/sh Modified Files: copyright.sh Log Message: clean up the progress printing a little bit, remove the sed duplication and false modification report on current-year copyrighted files. ws too. Index: copyright.sh =================================================================== RCS file: /cvsroot/brlcad/brlcad/sh/copyright.sh,v retrieving revision 14.13 retrieving revision 14.14 diff -w -u -r14.13 -r14.14 --- copyright.sh 20 Jan 2007 16:08:57 -0000 14.13 +++ copyright.sh 20 Jan 2007 21:26:03 -0000 14.14 @@ -120,69 +120,93 @@ # sanity checks if [ -d "$file" ] ; then - echo "." + echo "" echo "WARNING: $file is a directory, skipping" continue elif [ ! -f "$file" ] ; then - echo "." + echo "" echo "WARNING: $file does not exist, skipping" continue elif [ ! -r "$file" ] ; then - echo "." + echo "" echo "WARNING: $file is not readable" continue elif [ ! -w "$file" ] ; then - echo "." + echo "" echo "WARNING: $file is not writeable" continue fi + echo -n "." + if [ -f "$file.copyright.new" ] ; then - echo "." - echo "WARNING: $file.copyright.new is in the way (moving it to .bak)" + # echo "" + # echo "WARNING: $file.copyright.new is in the way (moving it to .bak)" mv $file.copyright.new $file.copyright.new.bak elif [ -f "$file.copyright.old" ] ; then - echo "." - echo "WARNING: $file.copyright.old is in the way (moving it to .bak)" + # echo "" + # echo "WARNING: $file.copyright.old is in the way (moving it to .bak)" mv $file.copyright.old $file.copyright.old.bak fi echo -n "." year=`date +%Y` sed "s/[cC][oO][pP][yY][rR][iI][gG][hH][tT] \{0,1\}(\{0,1\}[cC]\{0,1\})\{0,1\}.\{0,1\} \{0,1\}\([0-9][0-9][0-9][0-9]\) \{0,1\}-\{0,1\} \{0,1\}[0-9]\{0,1\}[0-9]\{0,1\}[0-9]\{0,1\}[0-9]\{0,1\}\([ .;]\{1,\}\)\(.*United \{1,\}States\)/Copyright (c) \1-$year\2\3/" < $file > $file.copyright.new + echo -n "." + modified=no filediff="`diff $file $file.copyright.new`" if [ "x$filediff" = "x" ] ; then - echo "." + echo -n "." rm $file.copyright.new elif [ ! "x`echo $filediff | grep \"No newline at end of file\"`" = "x" ] ; then echo ". `basename $file` has no newline -- SKIPPING" rm $file.copyright.new + continue elif [ ! "x`echo $filediff | grep \"Binary files\"`" = "x" ] ; then echo ". `basename $file` is binary -- SKIPPING" rm $file.copyright.new + continue else - echo ". `basename $file` modified" + echo -n "." + modified=yes mv $file $file.copyright.old mv $file.copyright.new $file fi + if [ "x$modified" = "xyes" ] ; then + # make sure it's not a current year sed "s/Copyright ([cC]) $year-$year/Copyright (c) $year/" < $file > $file.copyright.new + echo -n "." filediff="`diff $file $file.copyright.new`" if [ "x$filediff" = "x" ] ; then + echo -n "." rm $file.copyright.new elif [ ! "x`echo $filediff | grep \"No newline at end of file\"`" = "x" ] ; then + echo -n "." rm $file.copyright.new elif [ ! "x`echo $filediff | grep \"Binary files\"`" = "x" ] ; then + echo -n "." rm $file.copyright.new else + echo -n "." + modified=no mv $file $file.repeat.copyright.old mv $file.copyright.new $file fi - # done iteration over files -done + if [ "x$modified" = "xyes" ] ; then + echo -n ". `basename $file` is MODIFIED" + fi + fi + + echo "" + +done # iteration over files + +echo "" +echo "Done." # Local Variables: # mode: sh |