Timeline: Add missing include of unistd.h.
[nondaw.git] / scripts / scan-gpl
blob911d71292482822f6d7a147bc66de3595b36b31f
1 #!/bin/sh
3 # Copyright (C) 2008 Jonathan Moore Liles #
4 # #
5 # This program is free software; you can redistribute it and/or modify it #
6 # under the terms of the GNU General Public License as published by the #
7 # Free Software Foundation; either version 2 of the License, or (at your #
8 # option) any later version. #
9 # #
10 # This program is distributed in the hope that it will be useful, but WITHOUT #
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
13 # more details. #
14 # #
15 # You should have received a copy of the GNU General Public License along #
16 # with This program; see the file COPYING. If not,write to the Free Software #
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
19 #####
20 ## Simple script to scan source files for GPL headers.
23 R=0
25 for i in "$@"
27 HEAD="`head $i`"
31 if echo "$HEAD" | grep -q Copyright
32 then
33 if echo "$HEAD" | grep -q 'GNU General Public License'
34 then
35 S="GPL"
37 if echo "$HEAD" | grep -q 'version 2'
38 then
39 S="${S}v2"
40 elif echo "$HEAD" | grep -q 'version 3'
41 then
42 S="${S}v3"
45 if echo "$HEAD" | grep -q 'any later version'
46 then
47 S="${S}+"
49 else
50 S="Not GPL!"
51 R=255
54 else
55 S="No Copyright!"
56 R=255
59 printf "%-60s %s\n" "${i}:" "$S"
60 done
63 exit $R