diff options
-rwxr-xr-x | bin/chkcopyright | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/bin/chkcopyright b/bin/chkcopyright index 00cf7ee..8df68d3 100755 --- a/bin/chkcopyright +++ b/bin/chkcopyright @@ -34,6 +34,7 @@ EXTRACTEDFILE=/tmp/h5chkright.extracted.$$ VERBOSE= # default no DIRS=. # default current directory NFAILEDFILES=0 # Number of failed files found. +NPASSEDFILES=0 # Number of failed files found. NUMBEGINLINES=60 # Copyright notice should be located within the # this number of lines at the beginning of the file. COPYRIGHTSTR="Copyright by the Board of Trustees of the University of Illinois" @@ -275,6 +276,7 @@ C_SOURCE() f=$1 case `MATCH_COPYRIGHT $C_COPYRIGHT $f` in PASSED) + PASSED $f return ;; FAILED) @@ -293,6 +295,7 @@ FORTRAN_SOURCE() f=$1 case `MATCH_COPYRIGHT $FTN_COPYRIGHT $f` in PASSED) + PASSED $f return ;; FAILED) @@ -318,6 +321,8 @@ HTML_FILE() # show the differences FAILED $f $DIFF ${EXTRACTEDFILE} ${COPYRIGHTFILE} + else + PASSED $f fi } @@ -336,6 +341,8 @@ SHELL_FILE() # show the differences with the preferred style. FAILED $f $DIFF ${EXTRACTEDFILE} ${SH_COPYRIGHT} + else + PASSED $f fi } @@ -373,7 +380,7 @@ UNKNOWN_FILE() # Passed checking. # $1 file that has passed. # -PASS() +PASSED() { if test X-$VERBOSE = X-yes; then echo " PASSED" @@ -383,7 +390,7 @@ PASS() # Unknown file type. Considered a fail. -# $1 file that is skipped. +# $1 name of unknown file. # UNKNOWN_TYPE() { @@ -466,6 +473,9 @@ while read file; do done # check results +if [ -f $PASSEDLOG ]; then + NPASSEDFILES=`wc -l < $PASSEDLOG` +fi if [ -f $FAILEDLOG ]; then NFAILEDFILES=`wc -l < $FAILEDLOG` fi @@ -482,10 +492,12 @@ rm -f $PASSEDLOG $SKIPPEDLOG $FAILEDLOG echo "*******************" echo " REPORT" echo "*******************" +echo Number of passed files = $NPASSEDFILES +echo Number of failed files = $NFAILEDFILES + if [ $NFAILEDFILES -gt 0 ]; then - echo Number of failed files found = $NFAILEDFILES - exit 1 + exitcode=1 else - echo No failed files found - exit 0 + exitcode=0 fi +exit $exitcode |