summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2005-11-03 18:46:34 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2005-11-03 18:46:34 (GMT)
commit613faa7bc564ee213b81f6f687c23b1fefc2ab51 (patch)
treefe10f5c97b5bd2c8c50b35902de74d22dd78c854 /bin
parent4bd195c87eb3980289d327ff5d05f6bcd6fa570d (diff)
downloadhdf5-613faa7bc564ee213b81f6f687c23b1fefc2ab51.zip
hdf5-613faa7bc564ee213b81f6f687c23b1fefc2ab51.tar.gz
hdf5-613faa7bc564ee213b81f6f687c23b1fefc2ab51.tar.bz2
[svn-r11678] Purpose:
Bug fix, feature. Description: Fix a bug to recognize "#xyz..." is a comment in the init file. Add more binary data file types. Added prunepath command. Platforms tested: heping.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/chkcopyright64
1 files changed, 44 insertions, 20 deletions
diff --git a/bin/chkcopyright b/bin/chkcopyright
index b984efc..cdc308a 100755
--- a/bin/chkcopyright
+++ b/bin/chkcopyright
@@ -181,6 +181,14 @@ EOF
# prune Directories to be skipped. Notice this prunes all directories
# with the same name. E.g.,
# "prune test" skips test, fortran/test, c++/test, ...
+# (See -name option in the find command.)
+# prunepath Directory or file to be skipped. Notice this is different from
+# prunes since it matches the exact pathname. E.g.,
+# "prunepath ./tools/testfiles" skips the directory/file matching
+# exactly that path but NOT tools/h5dump/testfiles nor
+# tools/h5dump/testfiles.
+# (See -path option in the find command.)
+#
INITIALIZATION()
{
# clean up log files
@@ -197,7 +205,7 @@ INITIALIZATION()
if [ -r $INITFILE ]; then
while read key value; do
case "$key" in
- '#' | '') # Comment or blank line, skip it
+ \#* | '') # Comment or blank line, skip it
continue
;;
skip)
@@ -208,6 +216,10 @@ INITIALIZATION()
echo $key $value
EXCEPTIONDIRS="$EXCEPTIONDIRS -o -name $value"
;;
+ prunepath)
+ echo $key $value
+ EXCEPTIONDIRS="$EXCEPTIONDIRS -o -path $value"
+ ;;
*)
echo unknown setting input in file $INITFILE
echo $key $value
@@ -398,28 +410,39 @@ BATCH_FILE()
# Check Unknown type file.
-# Inspect the first 5 lines and try to guess what type of file it is.
-# Then try verify Copyright notice according to guessed type.
+# First check if there is something that resemble a copyright notice in
+# the first "page". If so, then inspect the first 5 lines to guess what
+# type of file it is. Then try verify Copyright notice according to
+# guessed type.
#
UNKNOWN_FILE()
{
f=$1
- head -5 < $f > $tmpfile
- if head -1 < $tmpfile | grep '^#!' > /dev/null; then
- # First line is "#!". It is likely a shell script or similar type.
- SHELL_FILE $f
- elif grep '^#' < $tmpfile > /dev/null; then
- # Some lines start with a "#". It may be a shell like type.
- SHELL_FILE $f
- elif grep '\/\*' < $tmpfile > /dev/null; then
- # Found some lines containing '/*'. It may be a C/C++ style file.
- C_SOURCE $f
- elif grep '^!' < $tmpfile > /dev/null; then
- # Some lines start with a "!". It may be a Fortran 9X style file.
- FORTRAN_SOURCE $f
- elif grep -i '^<html>' < $tmpfile > /dev/null; then
- # Some lines start with a "<html>". It may be an HTML file.
- HTML_FILE $f
+ if head -$NUMBEGINLINES < $f | grep "${COPYRIGHTSTR}" > /dev/null; then
+ # Now guess the file type and try match it.
+ head -5 < $f > $tmpfile
+ if head -1 < $tmpfile | grep '^#!' > /dev/null; then
+ # First line is "#!". It is likely a shell script or similar type.
+ SHELL_FILE $f
+ elif grep '\/\*' < $tmpfile > /dev/null; then
+ # Found some lines containing '/*'. It may be a C/C++ style file.
+ C_SOURCE $f
+ elif grep '^!' < $tmpfile > /dev/null; then
+ # Some lines start with a "!". It may be a Fortran 9X style file.
+ FORTRAN_SOURCE $f
+ elif grep '^#' < $tmpfile > /dev/null; then
+ # Some lines start with a "#". It may be a shell like type.
+ # Put this after C_SOURCE which may have #define and such lines.
+ SHELL_FILE $f
+ elif grep -i '^<html>' < $tmpfile > /dev/null || \
+ grep '^<!--' < $tmpfile > /dev/null ; then
+ # Some lines start with a "<html>" or having an html comment tag.
+ # It may be an HTML file.
+ HTML_FILE $f
+ else
+ # Unknown type.
+ UNKNOWN_TYPE $f
+ fi
else
# Unknown type.
UNKNOWN_TYPE $f
@@ -511,7 +534,8 @@ while read file; do
# Ignore HDF5 data files
continue
;;
- *.jpg )
+ *.jpg | *.obj | *.gif | *.png | *.pdf | \
+ *.JPG | *.OBJ | *.GIF | *.PNG | *.PDF )
# Ignore binary data files
continue
;;