diff options
Diffstat (limited to 'bin/chkcopyright')
-rwxr-xr-x | bin/chkcopyright | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/bin/chkcopyright b/bin/chkcopyright index 53f1478..c217743 100755 --- a/bin/chkcopyright +++ b/bin/chkcopyright @@ -31,11 +31,17 @@ DIRS=. # default current directory USAGE() { cat <<EOF -Usage: $PROGNAME [-h | -help] [dir1 dir2 ...] +Usage: $PROGNAME [-h | -help] [-fname name-patter] [-v | -v9] [dir1 dir2 ...] Check copyright notices of files in [dir1 dir2 ...}. Default is to check files in current directory. -h | -help show this page. + -fname name-pattern + limit to files of name-pattern + -v + verbose mode + -v9 + highly verbose EOF } @@ -50,6 +56,16 @@ PARSE_OPTION() USAGE exit 0 ;; + -fname ) + shift + FNAME="$1" + ;; + -v* ) + VERBOSE=yes + if test X$1 = X-v9; then + set -x + fi + ;; -* ) echo "***Unknown option ($1)" USAGE @@ -227,11 +243,21 @@ EOF # # Main body -PARSE_OPTION $* +PARSE_OPTION "$@" -find $DIRS -type f -print | +# use find to list all those file names and process them +# one by one. +( +if test -z "$FNAME" ; then + find $DIRS -type f -print +else + find $DIRS -type f -name "${FNAME}" -print +fi +) | while read file; do - #echo checking ${file}... + if test X-$VERBOSE = X-yes; then + echo checking ${file}... + fi case ${file} in *.c | *.h | *.cpp ) C_SOURCE ${file} |