diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2005-10-11 19:40:47 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2005-10-11 19:40:47 (GMT) |
commit | f210ec979aa81db64537ef4a2eed48979f8b32fe (patch) | |
tree | 72e5c018dba29778e8b6442df277923571cba514 /bin/chkcopyright | |
parent | 677c51b20a9affbd8d896e0e7cb4d313337f1891 (diff) | |
download | hdf5-f210ec979aa81db64537ef4a2eed48979f8b32fe.zip hdf5-f210ec979aa81db64537ef4a2eed48979f8b32fe.tar.gz hdf5-f210ec979aa81db64537ef4a2eed48979f8b32fe.tar.bz2 |
[svn-r11545] 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/chkcopyright')
-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 |