diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2005-10-11 19:40:43 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2005-10-11 19:40:43 (GMT) |
commit | 414249dcea536dd6f8b370212f8e51cf352b0756 (patch) | |
tree | 4414c5abd0dc2717932eeecc39667cc8ef22f12f /bin | |
parent | 1227373c51e89b1d8e1a2c2dbdb7308d72607d69 (diff) | |
download | hdf5-414249dcea536dd6f8b370212f8e51cf352b0756.zip hdf5-414249dcea536dd6f8b370212f8e51cf352b0756.tar.gz hdf5-414249dcea536dd6f8b370212f8e51cf352b0756.tar.bz2 |
[svn-r11544] Purpose:
New feature.
Description:
Added code that try to guess what type of file it is by inspecting the
first 5 lines. Then it tries to find the Copyright notice according
to the guess.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/chkcopyright | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/bin/chkcopyright b/bin/chkcopyright index 0dbf5de..62dd36c 100755 --- a/bin/chkcopyright +++ b/bin/chkcopyright @@ -26,6 +26,7 @@ PROGNAME=$0 DIFF="diff" INITFILE=.h5chkright.ini EXCEPTIONS=/tmp/h5chkright.except.$$ +tmpfile=/tmp/h5chkright_tmp.$$ EXCEPTIONDIRS="-name CVS" # at least skip CVS directories. EXTRACTEDFILE=/tmp/h5chkright.extracted.$$ VERBOSE= # default no @@ -337,6 +338,30 @@ SHELL_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. +# +UNKNOWN_FILE() +{ + f=$1 + head -5 < $f > $tmpfile + if head -1 < $tmpfile | grep '^#!' > /dev/null; then + # It is likely a shell script or similar type. + SHELL_FILE $f + elif grep '\/\*' < $tmpfile > /dev/null; then + # It is C/C++ style file. + C_SOURCE $f + elif grep '^!' < $tmpfile > /dev/null; then + # It is a Fortran 9X style file. + FORTRAN_SOURCE $f + else + # Unknown type. + UNKNOWN_TYPE $f + fi +} + + # Passed checking. # $1 file that has passed. # @@ -422,7 +447,7 @@ while read file; do continue ;; *) - UNKNOWN_TYPE $file + UNKNOWN_FILE $file ;; esac fi |