2003-07-23 09:28:43 +08:00
|
|
|
#! /bin/sh
|
2005-10-12 05:06:17 +08:00
|
|
|
#
|
2007-02-07 11:49:15 +08:00
|
|
|
# Copyright by The HDF Group.
|
2005-10-12 05:06:17 +08:00
|
|
|
# Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
|
|
|
# the files COPYING and Copyright.html. COPYING can be found at the root
|
|
|
|
# of the source code distribution tree; Copyright.html can be found at the
|
|
|
|
# root level of an installed copy of the electronic HDF5 document set and
|
|
|
|
# is linked from the top-level documents page. It can also be found at
|
2007-02-07 11:49:15 +08:00
|
|
|
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
|
|
|
# access to either file, you may request a copy from help@hdfgroup.org.
|
2005-10-12 05:06:17 +08:00
|
|
|
#
|
2003-07-23 09:28:43 +08:00
|
|
|
|
|
|
|
# Check Copyright notice.
|
|
|
|
# Check that all the files have the proper copyright notice.
|
|
|
|
# It goes down directories recursively.
|
|
|
|
#
|
|
|
|
# Programmer: Albert Cheng
|
|
|
|
# Created Data: 2003/07/22
|
2005-10-12 05:06:17 +08:00
|
|
|
# Modification:
|
|
|
|
# Rewrote most of it. Albert Cheng, 2005/10/10.
|
2003-07-23 09:28:43 +08:00
|
|
|
|
2005-10-11 13:03:43 +08:00
|
|
|
# Setup
|
|
|
|
#
|
2003-07-23 09:28:43 +08:00
|
|
|
PROGNAME=$0
|
|
|
|
DIFF="diff"
|
2005-10-11 13:03:43 +08:00
|
|
|
INITFILE=.h5chkright.ini
|
|
|
|
EXCEPTIONS=/tmp/h5chkright.except.$$
|
2005-10-12 03:40:43 +08:00
|
|
|
tmpfile=/tmp/h5chkright_tmp.$$
|
2007-02-07 11:49:15 +08:00
|
|
|
EXCEPTIONDIRS="-name CVS -o -name .svn" # at least skip CVS directories.
|
2005-10-11 13:03:43 +08:00
|
|
|
EXTRACTEDFILE=/tmp/h5chkright.extracted.$$
|
2003-07-23 09:28:43 +08:00
|
|
|
VERBOSE= # default no
|
2007-02-07 22:56:24 +08:00
|
|
|
FIXIT= # default no
|
2003-07-23 09:28:43 +08:00
|
|
|
DIRS=. # default current directory
|
2005-10-11 13:03:43 +08:00
|
|
|
NFAILEDFILES=0 # Number of failed files found.
|
2007-02-07 22:56:24 +08:00
|
|
|
NPASSEDFILES=0 # Number of passed files found.
|
|
|
|
NFIXEDFILES=0 # Number of files fixed.
|
|
|
|
NFIXFAILEDFILES=0 # Number of files fix failed.
|
2005-10-11 23:49:16 +08:00
|
|
|
NUMBEGINLINES=60 # Copyright notice should be located within the
|
|
|
|
# this number of lines at the beginning of the file.
|
2007-02-07 22:56:24 +08:00
|
|
|
UICOPYRIGHTSTR="Copyright by the Board of Trustees of the University of Illinois"
|
|
|
|
THGCOPYRIGHTSTR="Copyright by The HDF Group."
|
2005-10-11 23:49:16 +08:00
|
|
|
|
2005-10-11 13:03:43 +08:00
|
|
|
PASSEDLOG=/tmp/h5chkright_passed.$$
|
|
|
|
SKIPPEDLOG=/tmp/h5chkright_skipped.$$
|
|
|
|
FAILEDLOG=/tmp/h5chkright_failed.$$
|
2007-02-07 22:56:24 +08:00
|
|
|
FIXEDLOG=/tmp/h5chkright_fixed.$$
|
|
|
|
FIXFAILEDLOG=/tmp/h5chkright_fixfailed.$$
|
2005-10-11 13:03:43 +08:00
|
|
|
|
|
|
|
C_COPYRIGHT=/tmp/h5chkright_C.$$ # C style copyright
|
|
|
|
FTN_COPYRIGHT=/tmp/h5chkright_FTN.$$ # Fortran style copyright
|
|
|
|
HTM_COPYRIGHT=/tmp/h5chkright_HTM.$$ # HTML style copyright
|
|
|
|
SH_COPYRIGHT=/tmp/h5chkright_SH.$$ # SHELL style copyright
|
|
|
|
SH_COPYRIGHT2=/tmp/h5chkright_SH2.$$ # SHELL style copyright, 2nd style.
|
2005-11-01 23:08:36 +08:00
|
|
|
WINBAT_COPYRIGHT=/tmp/h5chkright_WINBAT.$$ # Windows Batch file Copyright notice
|
2007-02-08 12:13:59 +08:00
|
|
|
VMSCMD_COPYRIGHT=/tmp/h5chkright_VMSCMD.$$ # VMS command file Copyright notice
|
2012-08-29 01:47:52 +08:00
|
|
|
CONFIGURE_AC_COPYRIGHT=/tmp/h5chkright_CONFIGURE_AC.$$ # configure.ac file Copyright notice
|
2003-07-23 09:28:43 +08:00
|
|
|
|
2007-02-07 22:56:24 +08:00
|
|
|
tmpfixfile=/tmp/h5chkright_fix.$$ # Temporary fixed copy of file
|
|
|
|
|
2003-07-23 09:28:43 +08:00
|
|
|
|
2007-02-15 09:16:22 +08:00
|
|
|
# Caution message of the fix feature.
|
|
|
|
FIXCAUTIONMSG()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
**CAUTION**
|
|
|
|
The fix is a best attempt. Check the changes before committing them.
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-11 13:03:43 +08:00
|
|
|
# Help page
|
|
|
|
#
|
2003-07-23 09:28:43 +08:00
|
|
|
USAGE()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
2003-08-14 05:41:34 +08:00
|
|
|
Usage: $PROGNAME [-h | -help] [-fname name-patter] [-v | -v9] [dir1 dir2 ...]
|
2003-07-23 09:28:43 +08:00
|
|
|
Check copyright notices of files in [dir1 dir2 ...}.
|
|
|
|
Default is to check files in current directory.
|
|
|
|
-h | -help
|
|
|
|
show this page.
|
2003-08-14 05:41:34 +08:00
|
|
|
-fname name-pattern
|
|
|
|
limit to files of name-pattern
|
|
|
|
-v
|
|
|
|
verbose mode
|
|
|
|
-v9
|
|
|
|
highly verbose
|
2007-02-07 22:56:24 +08:00
|
|
|
-fix
|
2007-02-15 09:16:22 +08:00
|
|
|
fix failed files if possible.
|
2003-07-23 09:28:43 +08:00
|
|
|
EOF
|
2007-02-15 09:16:22 +08:00
|
|
|
FIXCAUTIONMSG
|
2003-07-23 09:28:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-15 05:33:49 +08:00
|
|
|
# Print Debug output
|
|
|
|
#
|
|
|
|
PRINTDEBUG()
|
|
|
|
{
|
|
|
|
if [ -n "$VERBOSE" ]; then
|
|
|
|
echo $*
|
|
|
|
else
|
|
|
|
: # noop
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-11 13:03:43 +08:00
|
|
|
# Generate various styles of Copyright notices
|
|
|
|
#
|
|
|
|
BUILDCOPYRIGHT()
|
|
|
|
{
|
|
|
|
# C and C++ source Copyright notice
|
|
|
|
cat > ${C_COPYRIGHT} << \EOF
|
2007-02-07 11:49:15 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2005-10-11 13:03:43 +08:00
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
2007-02-07 11:49:15 +08:00
|
|
|
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
* access to either file, you may request a copy from help@hdfgroup.org. *
|
2005-10-11 13:03:43 +08:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# Fortran9X source Copyright notice
|
|
|
|
cat > ${FTN_COPYRIGHT} << \EOF
|
2007-02-07 11:49:15 +08:00
|
|
|
! Copyright by The HDF Group. *
|
2005-10-11 13:03:43 +08:00
|
|
|
! Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
! All rights reserved. *
|
|
|
|
! *
|
|
|
|
! This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
! terms governing use, modification, and redistribution, is contained in *
|
|
|
|
! the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
! of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
! root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
! is linked from the top-level documents page. It can also be found at *
|
2007-02-07 11:49:15 +08:00
|
|
|
! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
! access to either file, you may request a copy from help@hdfgroup.org. *
|
2005-10-11 13:03:43 +08:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# HTML file Copyright notice
|
|
|
|
cat > ${HTM_COPYRIGHT} << \EOF
|
2007-02-07 11:49:15 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2005-10-11 13:03:43 +08:00
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
2007-02-07 11:49:15 +08:00
|
|
|
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
* access to either file, you may request a copy from help@hdfgroup.org. *
|
2005-10-11 13:03:43 +08:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# Shell style Copyright notice
|
|
|
|
cat > ${SH_COPYRIGHT} << \EOF
|
2007-02-07 11:49:15 +08:00
|
|
|
# Copyright by The HDF Group.
|
2005-10-11 13:03:43 +08:00
|
|
|
# Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
|
|
|
# the files COPYING and Copyright.html. COPYING can be found at the root
|
|
|
|
# of the source code distribution tree; Copyright.html can be found at the
|
|
|
|
# root level of an installed copy of the electronic HDF5 document set and
|
|
|
|
# is linked from the top-level documents page. It can also be found at
|
2007-02-07 11:49:15 +08:00
|
|
|
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
|
|
|
# access to either file, you may request a copy from help@hdfgroup.org.
|
2005-10-11 13:03:43 +08:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# Shell style Copyright notice (2nd type)
|
|
|
|
cat > ${SH_COPYRIGHT2} << \EOF
|
2007-02-07 11:49:15 +08:00
|
|
|
## Copyright by The HDF Group.
|
2005-10-11 13:03:43 +08:00
|
|
|
## Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
## All rights reserved.
|
|
|
|
##
|
|
|
|
## This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
## terms governing use, modification, and redistribution, is contained in
|
|
|
|
## the files COPYING and Copyright.html. COPYING can be found at the root
|
|
|
|
## of the source code distribution tree; Copyright.html can be found at the
|
|
|
|
## root level of an installed copy of the electronic HDF5 document set and
|
|
|
|
## is linked from the top-level documents page. It can also be found at
|
2007-02-07 11:49:15 +08:00
|
|
|
## http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
|
|
|
## access to either file, you may request a copy from help@hdfgroup.org.
|
2005-11-01 23:08:36 +08:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# Windows Batch file Copyright notice
|
|
|
|
cat > ${WINBAT_COPYRIGHT} << \EOF
|
2007-02-07 11:49:15 +08:00
|
|
|
@REM Copyright by The HDF Group.
|
2005-11-01 23:08:36 +08:00
|
|
|
@REM Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
@REM All rights reserved.
|
|
|
|
@REM
|
|
|
|
@REM This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
@REM terms governing use, modification, and redistribution, is contained in
|
|
|
|
@REM the files COPYING and Copyright.html. COPYING can be found at the root
|
|
|
|
@REM of the source code distribution tree; Copyright.html can be found at the
|
|
|
|
@REM root level of an installed copy of the electronic HDF5 document set and
|
|
|
|
@REM is linked from the top-level documents page. It can also be found at
|
2007-02-07 11:49:15 +08:00
|
|
|
@REM http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
|
|
|
@REM access to either file, you may request a copy from help@hdfgroup.org.
|
2007-02-21 03:56:59 +08:00
|
|
|
EOF
|
|
|
|
|
2012-08-29 01:47:52 +08:00
|
|
|
# configure.ac file Copyright notice
|
|
|
|
cat > ${CONFIGURE_AC_COPYRIGHT} << \EOF
|
2007-02-21 03:56:59 +08:00
|
|
|
dnl Copyright by The HDF Group.
|
|
|
|
dnl Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
dnl All rights reserved.
|
|
|
|
dnl
|
|
|
|
dnl This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
dnl terms governing use, modification, and redistribution, is contained in
|
|
|
|
dnl the files COPYING and Copyright.html. COPYING can be found at the root
|
|
|
|
dnl of the source code distribution tree; Copyright.html can be found at the
|
|
|
|
dnl root level of an installed copy of the electronic HDF5 document set and
|
|
|
|
dnl is linked from the top-level documents page. It can also be found at
|
|
|
|
dnl http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
|
|
|
dnl access to either file, you may request a copy from help@hdfgroup.org.
|
2007-02-08 12:13:59 +08:00
|
|
|
EOF
|
|
|
|
|
|
|
|
# VMS command file Copyright notice
|
|
|
|
cat > ${VMSCMD_COPYRIGHT} << \EOF
|
|
|
|
$!# Copyright by The HDF Group.
|
|
|
|
$!# Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
$!# All rights reserved.
|
|
|
|
$!#
|
|
|
|
$!# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
$!# terms governing use, modification, and redistribution, is contained in
|
|
|
|
$!# the files COPYING and Copyright.html. COPYING can be found at the root
|
|
|
|
$!# of the source code distribution tree; Copyright.html can be found at the
|
|
|
|
$!# root level of an installed copy of the electronic HDF5 document set and
|
|
|
|
$!# is linked from the top-level documents page. It can also be found at
|
|
|
|
$!# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
|
|
|
$!# access to either file, you may request a copy from help@hdfgroup.org.
|
2005-10-11 13:03:43 +08:00
|
|
|
EOF
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
# Initialization
|
|
|
|
#
|
|
|
|
# Initialize file format:
|
|
|
|
# Each line is a keyword for action and the rest are values.
|
|
|
|
# Keywords:
|
|
|
|
# '#' Comments
|
|
|
|
# skip Files to be skipped
|
|
|
|
# prune Directories to be skipped. Notice this prunes all directories
|
|
|
|
# with the same name. E.g.,
|
|
|
|
# "prune test" skips test, fortran/test, c++/test, ...
|
2005-11-04 02:46:34 +08:00
|
|
|
# (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.)
|
|
|
|
#
|
2005-10-11 13:03:43 +08:00
|
|
|
INITIALIZATION()
|
|
|
|
{
|
|
|
|
# clean up log files
|
2007-02-07 22:56:24 +08:00
|
|
|
rm -f $PASSEDLOG $SKIPPEDLOG $FAILEDLOG $FIXEDLOG $FIXFAILEDLOG
|
2005-10-11 13:03:43 +08:00
|
|
|
|
|
|
|
# Generate various styles of copyright notice.
|
|
|
|
BUILDCOPYRIGHT
|
|
|
|
|
|
|
|
echo Initialization...
|
|
|
|
# setup exceptions.
|
|
|
|
cp /dev/null $EXCEPTIONS
|
|
|
|
|
|
|
|
# Process Initial setting file if exists
|
|
|
|
if [ -r $INITFILE ]; then
|
|
|
|
while read key value; do
|
|
|
|
case "$key" in
|
2005-11-04 02:46:34 +08:00
|
|
|
\#* | '') # Comment or blank line, skip it
|
2005-10-11 13:03:43 +08:00
|
|
|
continue
|
|
|
|
;;
|
|
|
|
skip)
|
|
|
|
echo $key $value
|
|
|
|
echo $value >> $EXCEPTIONS
|
|
|
|
;;
|
|
|
|
prune)
|
|
|
|
echo $key $value
|
|
|
|
EXCEPTIONDIRS="$EXCEPTIONDIRS -o -name $value"
|
|
|
|
;;
|
2005-11-04 02:46:34 +08:00
|
|
|
prunepath)
|
|
|
|
echo $key $value
|
|
|
|
EXCEPTIONDIRS="$EXCEPTIONDIRS -o -path $value"
|
|
|
|
;;
|
2005-10-11 13:03:43 +08:00
|
|
|
*)
|
|
|
|
echo unknown setting input in file $INITFILE
|
|
|
|
echo $key $value
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done < $INITFILE
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Change EXCEPTIONDIRS to be compatible with find command.
|
|
|
|
EXCEPTIONDIRS="( $EXCEPTIONDIRS ) -prune -o"
|
|
|
|
echo Initialization done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-23 09:28:43 +08:00
|
|
|
# Parse Options
|
|
|
|
#
|
|
|
|
PARSE_OPTION()
|
|
|
|
{
|
|
|
|
while test $# -gt 0 ; do
|
|
|
|
case "$1" in
|
|
|
|
-h | -help )
|
|
|
|
USAGE
|
|
|
|
exit 0
|
|
|
|
;;
|
2003-08-14 05:41:34 +08:00
|
|
|
-fname )
|
|
|
|
shift
|
|
|
|
FNAME="$1"
|
|
|
|
;;
|
2007-02-07 22:56:24 +08:00
|
|
|
-fix )
|
|
|
|
FIXIT=yes
|
|
|
|
;;
|
2003-08-14 05:41:34 +08:00
|
|
|
-v* )
|
|
|
|
VERBOSE=yes
|
|
|
|
if test X$1 = X-v9; then
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
;;
|
2003-07-23 09:28:43 +08:00
|
|
|
-* )
|
|
|
|
echo "***Unknown option ($1)"
|
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
DIRS=$*
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-02 00:59:59 +08:00
|
|
|
# Rinse the file by,
|
|
|
|
# removing all \r which is often present in Windows files;
|
|
|
|
# replace tabs with equivalent spaces;
|
|
|
|
# removing all trailing spaces.
|
|
|
|
# $1 is the file to be rinsed.
|
|
|
|
RINSE()
|
|
|
|
{
|
|
|
|
rf=$1
|
|
|
|
cp $rf $tmpfile
|
|
|
|
dos2unix < $tmpfile | expand | sed -e 's/ *$//' > $rf
|
|
|
|
}
|
|
|
|
|
2007-02-07 22:56:24 +08:00
|
|
|
# Locate a line in the file and print the line number.
|
|
|
|
# Print 0 if not found; -1 if error.
|
|
|
|
# $1 The line.
|
|
|
|
# $2 The file.
|
|
|
|
#
|
|
|
|
FindLineInFile()
|
|
|
|
{
|
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
# expect two arguments
|
|
|
|
echo -1
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
xline=$1
|
|
|
|
xf=$2
|
|
|
|
xpos=`grep -n "${xline}" $xf`
|
|
|
|
if [ "$?" -ne 0 ] ; then
|
|
|
|
# Not found, return 0
|
|
|
|
xpos=0
|
|
|
|
else
|
|
|
|
xpos=`echo $xpos | cut -f1 -d:`
|
|
|
|
fi
|
|
|
|
echo $xpos
|
|
|
|
}
|
|
|
|
|
2005-11-02 00:59:59 +08:00
|
|
|
|
2005-10-11 23:49:16 +08:00
|
|
|
# Match Copyright notice.
|
|
|
|
# $1 file which contains the expected copyright notice.
|
|
|
|
# $2 file in which to look for the copyright notice.
|
|
|
|
# Copyright notice must be found within the beginning $NUMBEGINLINES of lines.
|
2007-02-07 22:56:24 +08:00
|
|
|
# Hunt for the particular string $UICOPYRIGHTSTR which signifies the beginning
|
2005-10-11 23:49:16 +08:00
|
|
|
# of the copyright notice.
|
|
|
|
#
|
|
|
|
MATCH_COPYRIGHT()
|
|
|
|
{
|
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
# expect two arguments
|
|
|
|
echo FAILED
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
COPYRIGHTFILE=$1
|
|
|
|
f=$2
|
2007-02-07 22:56:24 +08:00
|
|
|
nlines=`wc -l ${COPYRIGHTFILE} | cut -f1 -d' '`
|
2007-02-07 11:49:15 +08:00
|
|
|
# Find a line that contains the copyright string and its line number in
|
|
|
|
# the file.
|
2007-02-07 22:56:24 +08:00
|
|
|
begin=`FindLineInFile "${UICOPYRIGHTSTR}" $f`
|
|
|
|
if [ "$begin" -le 0 ] ; then
|
2007-02-07 11:49:15 +08:00
|
|
|
# Not found, generate an empty dummy file
|
|
|
|
cp /dev/null ${EXTRACTEDFILE}
|
|
|
|
false
|
|
|
|
else
|
|
|
|
if [ $begin -gt 1 ]; then
|
|
|
|
begin=`expr $begin - 1`
|
|
|
|
fi
|
|
|
|
end=`expr $begin + $nlines - 1`
|
|
|
|
sed -n -e "${begin},${end}p" < $f > ${EXTRACTEDFILE}
|
|
|
|
RINSE ${EXTRACTEDFILE}
|
|
|
|
$DIFF ${EXTRACTEDFILE} ${COPYRIGHTFILE} >/dev/null 2>&1
|
|
|
|
fi
|
2005-10-11 23:49:16 +08:00
|
|
|
if test $? -eq 0; then
|
|
|
|
echo PASSED
|
|
|
|
else
|
|
|
|
echo FAILED
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2007-02-07 22:56:24 +08:00
|
|
|
# Fix Copyright notice.
|
|
|
|
# $1 file which contains the expected copyright notice.
|
|
|
|
# $2 file in which to look for the copyright notice.
|
|
|
|
# Copyright notice must be found within the beginning $NUMBEGINLINES of lines.
|
|
|
|
# Hunt for the particular string $UICOPYRIGHTSTR which signifies the beginning
|
|
|
|
# of the copyright notice.
|
|
|
|
#
|
|
|
|
FIX_COPYRIGHT()
|
|
|
|
{
|
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
# expect two arguments
|
|
|
|
echo FAILED
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
COPYRIGHTFILE=$1
|
|
|
|
f=$2
|
|
|
|
nlines=`wc -l ${COPYRIGHTFILE} | cut -f1 -d' '`
|
|
|
|
# If the file has UICOPYRIGHTSTR but not THGCOPYRIGHTSTR, then replace the lines
|
|
|
|
# starting at UICOPYRIGHTSTR and down.
|
|
|
|
# If the file has THGCOPYRIGHTSTR, then replace the lines starting at the
|
|
|
|
# THGCOPYRIGHTSTR and down.
|
|
|
|
# If neither found, abort it.
|
|
|
|
|
|
|
|
# Find a line that contains the THG copyright string and its line number in
|
|
|
|
# the file.
|
|
|
|
insertbegin=`FindLineInFile "${THGCOPYRIGHTSTR}" $f`
|
|
|
|
if [ $insertbegin -gt 0 ]; then
|
|
|
|
insertend=`expr $insertbegin + $nlines` # no need to -1. See below.
|
|
|
|
else
|
|
|
|
insertbegin=`FindLineInFile "${UICOPYRIGHTSTR}" $f`
|
|
|
|
if [ $insertbegin -gt 0 ]; then
|
|
|
|
insertend=`expr $insertbegin + $nlines - 1` # no need to -2. See below.
|
|
|
|
else
|
|
|
|
FIXFAILED
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Copy line 1 up to insertbegin from original file
|
|
|
|
xbegin=`expr $insertbegin - 1`
|
|
|
|
if [ $xbegin -gt 0 ]; then
|
|
|
|
sed -n -e "1,${xbegin}p" $f > $tmpfixfile
|
|
|
|
else
|
|
|
|
cp /dev/null $tmpfixfile # make it empty.
|
|
|
|
fi
|
|
|
|
|
|
|
|
# now the correct copyright file
|
|
|
|
cat $COPYRIGHTFILE >> $tmpfixfile
|
|
|
|
|
|
|
|
# the rest of the original file
|
|
|
|
sed -n -e "${insertend},"'$p' $f >> $tmpfixfile
|
|
|
|
|
|
|
|
# copy them all back to the original file
|
|
|
|
cp $tmpfixfile $f
|
|
|
|
FIXED
|
|
|
|
rm -f $tmpfixfile
|
|
|
|
}
|
|
|
|
|
2003-07-23 09:28:43 +08:00
|
|
|
# Check C and C++ source files
|
|
|
|
#
|
|
|
|
C_SOURCE()
|
|
|
|
{
|
|
|
|
f=$1
|
2005-10-11 23:49:16 +08:00
|
|
|
case `MATCH_COPYRIGHT $C_COPYRIGHT $f` in
|
|
|
|
PASSED)
|
2005-10-30 14:00:50 +08:00
|
|
|
PASSED $f
|
2005-10-11 23:49:16 +08:00
|
|
|
return
|
|
|
|
;;
|
|
|
|
FAILED)
|
2003-07-23 09:28:43 +08:00
|
|
|
# show the difference
|
2005-10-11 13:03:43 +08:00
|
|
|
FAILED $f
|
2005-10-11 23:49:16 +08:00
|
|
|
$DIFF ${EXTRACTEDFILE} ${C_COPYRIGHT}
|
2007-02-07 22:56:24 +08:00
|
|
|
if [ -n "$FIXIT" ]; then
|
|
|
|
FIX_COPYRIGHT $C_COPYRIGHT $f
|
|
|
|
fi
|
2005-10-11 23:49:16 +08:00
|
|
|
;;
|
|
|
|
esac
|
2003-07-23 09:28:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Check Fortran90 source files
|
|
|
|
#
|
|
|
|
FORTRAN_SOURCE()
|
|
|
|
{
|
|
|
|
f=$1
|
2005-10-11 23:49:16 +08:00
|
|
|
case `MATCH_COPYRIGHT $FTN_COPYRIGHT $f` in
|
|
|
|
PASSED)
|
2005-10-30 14:00:50 +08:00
|
|
|
PASSED $f
|
2005-10-11 23:49:16 +08:00
|
|
|
return
|
|
|
|
;;
|
|
|
|
FAILED)
|
|
|
|
# show the difference
|
2005-10-11 13:03:43 +08:00
|
|
|
FAILED $f
|
2005-10-11 23:49:16 +08:00
|
|
|
$DIFF ${EXTRACTEDFILE} ${FTN_COPYRIGHT}
|
2007-02-08 01:55:01 +08:00
|
|
|
if [ -n "$FIXIT" ]; then
|
|
|
|
FIX_COPYRIGHT $FTN_COPYRIGHT $f
|
|
|
|
fi
|
2005-10-11 23:49:16 +08:00
|
|
|
;;
|
|
|
|
esac
|
2003-07-23 09:28:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Check HTML Files
|
|
|
|
#
|
|
|
|
HTML_FILE()
|
|
|
|
{
|
|
|
|
f=$1
|
2005-11-10 06:23:58 +08:00
|
|
|
case `MATCH_COPYRIGHT $HTM_COPYRIGHT $f` in
|
|
|
|
PASSED)
|
2005-10-30 14:00:50 +08:00
|
|
|
PASSED $f
|
2005-11-10 06:23:58 +08:00
|
|
|
return
|
|
|
|
;;
|
|
|
|
FAILED)
|
|
|
|
# show the difference
|
|
|
|
FAILED $f
|
|
|
|
$DIFF ${EXTRACTEDFILE} ${HTM_COPYRIGHT}
|
2007-02-15 06:53:48 +08:00
|
|
|
if [ -n "$FIXIT" ]; then
|
|
|
|
FIX_COPYRIGHT $HTM_COPYRIGHT $f
|
|
|
|
fi
|
2005-11-10 06:23:58 +08:00
|
|
|
;;
|
|
|
|
esac
|
2003-07-23 09:28:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-08 03:44:07 +08:00
|
|
|
# Check Shell script files which use the style of copyright notice of leading #'s.
|
|
|
|
#
|
|
|
|
SHELL_FILE()
|
|
|
|
{
|
|
|
|
f=$1
|
|
|
|
case `MATCH_COPYRIGHT $SH_COPYRIGHT $f` in
|
|
|
|
PASSED)
|
|
|
|
PASSED $f
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
FAILED)
|
|
|
|
# show the difference
|
|
|
|
FAILED $f
|
|
|
|
$DIFF ${EXTRACTEDFILE} ${SH_COPYRIGHT}
|
|
|
|
if [ -n "$FIXIT" ]; then
|
|
|
|
FIX_COPYRIGHT $SH_COPYRIGHT $f
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-08 06:30:41 +08:00
|
|
|
# Check files that use #'s as comments such as Makefile.
|
|
|
|
# The Copyright body of text happen to be the same as used by Shell script
|
|
|
|
# files.
|
2003-07-23 09:28:43 +08:00
|
|
|
#
|
2007-02-08 03:44:07 +08:00
|
|
|
MAKE_FILE()
|
2003-07-23 09:28:43 +08:00
|
|
|
{
|
|
|
|
f=$1
|
2007-02-08 06:30:41 +08:00
|
|
|
case `MATCH_COPYRIGHT $SH_COPYRIGHT $f` in
|
|
|
|
PASSED)
|
|
|
|
PASSED $f
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
FAILED)
|
|
|
|
# show the difference
|
2005-10-11 23:49:16 +08:00
|
|
|
FAILED $f
|
|
|
|
$DIFF ${EXTRACTEDFILE} ${SH_COPYRIGHT}
|
2007-02-08 06:30:41 +08:00
|
|
|
if [ -n "$FIXIT" ]; then
|
|
|
|
FIX_COPYRIGHT $SH_COPYRIGHT $f
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2003-07-23 09:28:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-01 23:08:36 +08:00
|
|
|
# Check Windows Batch files
|
|
|
|
#
|
|
|
|
BATCH_FILE()
|
|
|
|
{
|
|
|
|
f=$1
|
|
|
|
case `MATCH_COPYRIGHT $WINBAT_COPYRIGHT $f` in
|
|
|
|
PASSED)
|
|
|
|
PASSED $f
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
FAILED)
|
|
|
|
# show the difference
|
|
|
|
FAILED $f
|
|
|
|
$DIFF ${EXTRACTEDFILE} ${WINBAT_COPYRIGHT}
|
2007-02-08 03:44:07 +08:00
|
|
|
if [ -n "$FIXIT" ]; then
|
|
|
|
FIX_COPYRIGHT $WINBAT_COPYRIGHT $f
|
|
|
|
fi
|
2005-11-01 23:08:36 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-08 12:13:59 +08:00
|
|
|
# Check Windows Batch files
|
|
|
|
#
|
|
|
|
VMSCMD_FILE()
|
|
|
|
{
|
|
|
|
f=$1
|
|
|
|
case `MATCH_COPYRIGHT $VMSCMD_COPYRIGHT $f` in
|
|
|
|
PASSED)
|
|
|
|
PASSED $f
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
FAILED)
|
|
|
|
# show the difference
|
|
|
|
FAILED $f
|
|
|
|
$DIFF ${EXTRACTEDFILE} ${VMSCMD_COPYRIGHT}
|
|
|
|
if [ -n "$FIXIT" ]; then
|
|
|
|
FIX_COPYRIGHT $VMSCMD_COPYRIGHT $f
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-21 03:56:59 +08:00
|
|
|
# Check Configure.in type files
|
|
|
|
#
|
2012-08-29 01:47:52 +08:00
|
|
|
CONFIGURE_AC_FILE()
|
2007-02-21 03:56:59 +08:00
|
|
|
{
|
|
|
|
f=$1
|
2012-08-29 01:47:52 +08:00
|
|
|
case `MATCH_COPYRIGHT $CONFIGURE_AC_COPYRIGHT $f` in
|
2007-02-21 03:56:59 +08:00
|
|
|
PASSED)
|
|
|
|
PASSED $f
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
FAILED)
|
|
|
|
# show the difference
|
|
|
|
FAILED $f
|
2012-08-29 01:47:52 +08:00
|
|
|
$DIFF ${EXTRACTEDFILE} ${CONFIGURE_AC_COPYRIGHT}
|
2007-02-21 03:56:59 +08:00
|
|
|
if [ -n "$FIXIT" ]; then
|
2012-08-29 01:47:52 +08:00
|
|
|
FIX_COPYRIGHT $CONFIGURE_AC_COPYRIGHT $f
|
2007-02-21 03:56:59 +08:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-15 05:33:49 +08:00
|
|
|
# Guess the type of file.
|
|
|
|
# Inspect the first 5 lines to guess what type of file it is.
|
|
|
|
#
|
|
|
|
GUESS_File_Type()
|
|
|
|
{
|
|
|
|
if [ $# -ne 1 ]; then
|
|
|
|
echo "wrong number of arguments($#)"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
f=$1
|
|
|
|
# Now guess the file type.
|
|
|
|
head -5 < $f > $tmpfile
|
|
|
|
if head -1 < $tmpfile | grep '^#!' > /dev/null; then
|
|
|
|
# First line is "#!". It is likely a shell script or similar type.
|
|
|
|
echo SHELL_FILE
|
|
|
|
elif grep '\/\*' < $tmpfile > /dev/null; then
|
|
|
|
# Found some lines containing '/*'. It may be a C/C++ style file.
|
|
|
|
echo C_SOURCE
|
|
|
|
elif grep '^!' < $tmpfile > /dev/null; then
|
|
|
|
# Some lines start with a "!". It may be a Fortran 9X style file.
|
|
|
|
echo FORTRAN_SOURCE
|
|
|
|
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.
|
|
|
|
echo SHELL_FILE
|
2007-02-21 03:56:59 +08:00
|
|
|
elif grep '^dnl' < $tmpfile > /dev/null; then
|
2012-08-29 01:47:52 +08:00
|
|
|
# Some lines start with a "dnl". It may be a configure.ac type file.
|
|
|
|
echo CONFIGURE_AC_FILE
|
2007-02-15 05:33:49 +08:00
|
|
|
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.
|
|
|
|
echo HTML_FILE
|
|
|
|
else
|
|
|
|
# Unknown type.
|
|
|
|
echo UNKNOWN_TYPE
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-12 03:40:43 +08:00
|
|
|
# Check Unknown type file.
|
2005-11-04 02:46:34 +08:00
|
|
|
# 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.
|
2005-10-12 03:40:43 +08:00
|
|
|
#
|
|
|
|
UNKNOWN_FILE()
|
|
|
|
{
|
|
|
|
f=$1
|
2007-02-15 05:33:49 +08:00
|
|
|
if head -$NUMBEGINLINES < $f | grep "${COPYRIGHTSTR}" > /dev/null; then
|
|
|
|
xftype=`GUESS_File_Type $f`
|
|
|
|
PRINTDEBUG f=$f xftype=$xftype > /dev/tty
|
|
|
|
case $xftype in
|
|
|
|
SHELL_FILE) SHELL_FILE $f;;
|
|
|
|
C_SOURCE) C_SOURCE $f;;
|
|
|
|
FORTRAN_SOURCE) FORTRAN_SOURCE $f;;
|
|
|
|
SHELL_FILE) SHELL_FILE $f;;
|
|
|
|
HTML_FILE) HTML_FILE $f;;
|
|
|
|
UNKNOWN_TYPE) UNKNOWN_TYPE $f;;
|
|
|
|
esac
|
2005-10-12 03:40:43 +08:00
|
|
|
else
|
|
|
|
# Unknown type.
|
|
|
|
UNKNOWN_TYPE $f
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-11 13:03:43 +08:00
|
|
|
# Passed checking.
|
|
|
|
# $1 file that has passed.
|
2003-08-12 05:32:17 +08:00
|
|
|
#
|
2005-10-30 14:00:50 +08:00
|
|
|
PASSED()
|
2003-08-12 05:32:17 +08:00
|
|
|
{
|
2005-10-11 13:03:43 +08:00
|
|
|
if test X-$VERBOSE = X-yes; then
|
|
|
|
echo " PASSED"
|
|
|
|
fi
|
|
|
|
echo $1 >> $PASSEDLOG
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Unknown file type. Considered a fail.
|
2005-10-30 14:00:50 +08:00
|
|
|
# $1 name of unknown file.
|
2005-09-28 04:04:37 +08:00
|
|
|
#
|
2005-10-11 13:03:43 +08:00
|
|
|
UNKNOWN_TYPE()
|
|
|
|
{
|
|
|
|
echo "UNKNOWN type: $1" | tee -a $FAILEDLOG
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Skip checking.
|
|
|
|
# $1 file that is skipped.
|
|
|
|
#
|
|
|
|
SKIP()
|
|
|
|
{
|
|
|
|
if test X-$VERBOSE = X-yes; then
|
|
|
|
echo " SKIPPED"
|
2003-08-12 05:32:17 +08:00
|
|
|
fi
|
2005-10-11 13:03:43 +08:00
|
|
|
echo $1 >> $SKIPPEDLOG
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Failed checking.
|
|
|
|
# $1 file that has failed.
|
|
|
|
#
|
|
|
|
FAILED()
|
|
|
|
{
|
|
|
|
echo "FAILED: $1"
|
|
|
|
echo $1 >> $FAILEDLOG
|
2003-08-12 05:32:17 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-07 22:56:24 +08:00
|
|
|
# Copyright fixed.
|
|
|
|
# $1 file that has been fixed.
|
|
|
|
#
|
|
|
|
FIXED()
|
|
|
|
{
|
|
|
|
if test X-$VERBOSE = X-yes; then
|
|
|
|
echo " FIXED"
|
|
|
|
fi
|
|
|
|
echo $1 >> $FIXEDLOG
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Copyright fix failed.
|
|
|
|
# $1 file that has failed.
|
|
|
|
#
|
|
|
|
FIXFAILED()
|
|
|
|
{
|
|
|
|
echo "FIX FAILED: $1"
|
|
|
|
echo $1 >> $FIXFAILEDLOG
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-23 09:28:43 +08:00
|
|
|
#
|
|
|
|
# Main body
|
|
|
|
|
2003-08-14 05:41:34 +08:00
|
|
|
PARSE_OPTION "$@"
|
2005-10-11 13:03:43 +08:00
|
|
|
INITIALIZATION
|
2003-07-23 09:28:43 +08:00
|
|
|
|
2003-08-14 05:41:34 +08:00
|
|
|
# use find to list all those file names and process them
|
|
|
|
# one by one.
|
|
|
|
if test -z "$FNAME" ; then
|
2005-10-11 13:03:43 +08:00
|
|
|
find $DIRS $EXCEPTIONDIRS -type f -print
|
2003-08-14 05:41:34 +08:00
|
|
|
else
|
|
|
|
find $DIRS -type f -name "${FNAME}" -print
|
2005-10-11 13:03:43 +08:00
|
|
|
fi |
|
2003-07-23 09:28:43 +08:00
|
|
|
while read file; do
|
2003-08-14 05:41:34 +08:00
|
|
|
if test X-$VERBOSE = X-yes; then
|
|
|
|
echo checking ${file}...
|
|
|
|
fi
|
2005-10-11 13:03:43 +08:00
|
|
|
if echo $file | egrep -f $EXCEPTIONS > /dev/null; then
|
|
|
|
SKIP ${file}
|
|
|
|
else
|
|
|
|
case ${file} in
|
|
|
|
*.c | *.h | *.cpp )
|
|
|
|
C_SOURCE ${file}
|
|
|
|
;;
|
|
|
|
*.f90 )
|
|
|
|
FORTRAN_SOURCE ${file}
|
|
|
|
;;
|
|
|
|
*.htm | *.html )
|
|
|
|
HTML_FILE ${file}
|
|
|
|
;;
|
2007-02-08 03:44:07 +08:00
|
|
|
*.sh | *.sh.in )
|
2005-10-11 13:03:43 +08:00
|
|
|
SHELL_FILE ${file}
|
|
|
|
;;
|
2007-02-15 06:23:14 +08:00
|
|
|
*.pl )
|
|
|
|
# Perl script files are similar to Shell files
|
|
|
|
SHELL_FILE ${file}
|
|
|
|
;;
|
|
|
|
*Makefile | *Makefile.in | *Makefile.am | Makefile.dist )
|
2007-02-08 03:44:07 +08:00
|
|
|
MAKE_FILE ${file}
|
|
|
|
;;
|
2012-08-29 01:47:52 +08:00
|
|
|
configure.ac )
|
|
|
|
CONFIGURE_AC_FILE ${file}
|
2007-02-21 03:56:59 +08:00
|
|
|
;;
|
2005-11-01 23:08:36 +08:00
|
|
|
*.bat | *.BAT )
|
|
|
|
# Windows Batch files
|
|
|
|
BATCH_FILE ${file}
|
|
|
|
;;
|
2007-02-08 12:13:59 +08:00
|
|
|
*.com )
|
|
|
|
# VMS Command files
|
|
|
|
VMSCMD_FILE ${file}
|
|
|
|
;;
|
2005-10-30 06:05:10 +08:00
|
|
|
*.h5 | *.hdf5 )
|
2005-10-11 13:03:43 +08:00
|
|
|
# Ignore HDF5 data files
|
|
|
|
continue
|
|
|
|
;;
|
2005-11-04 02:46:34 +08:00
|
|
|
*.jpg | *.obj | *.gif | *.png | *.pdf | \
|
|
|
|
*.JPG | *.OBJ | *.GIF | *.PNG | *.PDF )
|
2005-10-30 06:05:10 +08:00
|
|
|
# Ignore binary data files
|
|
|
|
continue
|
|
|
|
;;
|
2005-11-03 03:27:12 +08:00
|
|
|
*.zip | *.dsp | *.dsw | *.js | *.sln )
|
2005-11-02 00:59:59 +08:00
|
|
|
# Ignore Windows binary or special files.
|
2005-11-03 03:27:12 +08:00
|
|
|
# .dsp & .dsw are Visual Studio project files.
|
|
|
|
# .sln are .NET solution files.
|
|
|
|
# .js are Microsoft Java Script files.
|
2005-11-01 23:08:36 +08:00
|
|
|
continue
|
|
|
|
;;
|
2005-10-11 13:03:43 +08:00
|
|
|
*CVS/* )
|
|
|
|
# Ignore CVS control files.
|
|
|
|
continue
|
|
|
|
;;
|
2007-02-08 06:30:41 +08:00
|
|
|
*.txt | *.TXT )
|
|
|
|
# Ignore text files.
|
|
|
|
continue
|
|
|
|
;;
|
2005-10-11 13:03:43 +08:00
|
|
|
*)
|
2005-10-12 03:40:43 +08:00
|
|
|
UNKNOWN_FILE $file
|
2005-10-11 13:03:43 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2003-07-23 09:28:43 +08:00
|
|
|
done
|
|
|
|
|
2005-10-11 13:03:43 +08:00
|
|
|
# check results
|
2005-10-30 14:00:50 +08:00
|
|
|
if [ -f $PASSEDLOG ]; then
|
|
|
|
NPASSEDFILES=`wc -l < $PASSEDLOG`
|
|
|
|
fi
|
2005-10-11 13:03:43 +08:00
|
|
|
if [ -f $FAILEDLOG ]; then
|
|
|
|
NFAILEDFILES=`wc -l < $FAILEDLOG`
|
|
|
|
fi
|
2007-02-07 22:56:24 +08:00
|
|
|
if [ -f $FIXEDLOG ]; then
|
|
|
|
NFIXEDFILES=`wc -l < $FIXEDLOG`
|
|
|
|
fi
|
|
|
|
if [ -f $FIXFAILEDLOG ]; then
|
|
|
|
NFIXFAILEDFILES=`wc -l < $FIXFAILEDLOG`
|
|
|
|
fi
|
2005-10-11 13:03:43 +08:00
|
|
|
|
2003-07-23 09:28:43 +08:00
|
|
|
# Cleanup
|
2005-10-11 13:03:43 +08:00
|
|
|
rm -f $C_COPYRIGHT $FTN_COPYRIGHT $HTM_COPYRIGHT $SH_COPYRIGHT $SH_COPYRIGHT2
|
|
|
|
rm -f $EXCEPTIONS $EXTRACTEDFILE
|
2007-02-07 22:56:24 +08:00
|
|
|
rm -f $PASSEDLOG $SKIPPEDLOG $FAILEDLOG $FIXEDLOG $FIXFAILEDLOG
|
2005-10-11 13:03:43 +08:00
|
|
|
|
|
|
|
# Report Results
|
2007-02-07 22:56:24 +08:00
|
|
|
# Results are not total accurate--e.g., Skipped are not counted, thus not
|
2005-10-12 05:06:17 +08:00
|
|
|
# reported.
|
|
|
|
#
|
2005-10-11 13:03:43 +08:00
|
|
|
echo "*******************"
|
|
|
|
echo " REPORT"
|
|
|
|
echo "*******************"
|
2005-10-30 14:00:50 +08:00
|
|
|
echo Number of passed files = $NPASSEDFILES
|
|
|
|
echo Number of failed files = $NFAILEDFILES
|
2007-02-07 22:56:24 +08:00
|
|
|
echo Number of fixed files = $NFIXEDFILES
|
|
|
|
echo Number of fix failed files = $NFIXFAILEDFILES
|
2007-02-15 09:16:22 +08:00
|
|
|
if [ $NFIXEDFILES -gt 0 ]; then
|
|
|
|
FIXCAUTIONMSG
|
|
|
|
fi
|
2005-10-30 14:00:50 +08:00
|
|
|
|
2005-10-11 13:03:43 +08:00
|
|
|
if [ $NFAILEDFILES -gt 0 ]; then
|
2005-10-30 14:00:50 +08:00
|
|
|
exitcode=1
|
2005-10-11 13:03:43 +08:00
|
|
|
else
|
2005-10-30 14:00:50 +08:00
|
|
|
exitcode=0
|
2005-10-11 13:03:43 +08:00
|
|
|
fi
|
2005-10-30 14:00:50 +08:00
|
|
|
exit $exitcode
|