aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/hasCopyright.sh
blob: 82182fc1a4d46e83713ac379672ba2a004b91664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

# Scan files given on the command line for a copyright header.
# Only the first 15 lines will be examined and must contain the
# string 'Copyright'.
#
# Sample usage:
# find . -type f -name \*.cpp -o -name \*.h | xargs ~/bin/hasCopyright.sh

for i in $@ ; do
    if test -f "$i" && test -s "$i" ; then
        if head -n 15 "$i" | grep Copyright > /dev/null 2>&1 &&
	   head -n 15 "$i" | grep "No Commercial Usage" > /dev/null 2>&1 ; then
            echo "$i: Copyright."
        else
           echo "$i: NO/WRONG COPYRIGHT."
        fi
    fi
done