git-svn-id: https://scorched3d.svn.sourceforge.net/svnroot/scorched3d/trunk/scorched...
[scorched3d/parasti.git] / scripts / addGPLLines.pl
blob65acadc93acf70008454afce536417ad5566d514
1 use strict;
3 my @dirs =
5 "3dsparse",
6 "actions",
7 "client",
8 "common",
9 "coms",
10 "dialogs",
11 "engine",
12 "GLEXT",
13 "cgext",
14 "GLW",
15 "landscape",
16 "landscapedef",
17 "scorched",
18 "ships",
19 "server",
20 "target",
21 "sprites",
22 "tank",
23 "placement",
24 "tankai",
25 "tankgraph",
26 "boids",
27 "sound",
28 "weapons"
31 my $text = "////////////////////////////////////////////////////////////////////////////////
32 // Scorched3D (c) 2000-2006
34 // This file is part of Scorched3D.
36 // Scorched3D is free software; you can redistribute it and/or modify
37 // it under the terms of the GNU General Public License as published by
38 // the Free Software Foundation; either version 2 of the License, or
39 // (at your option) any later version.
41 // Scorched3D is distributed in the hope that it will be useful,
42 // but WITHOUT ANY WARRANTY; without even the implied warranty of
43 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 // GNU General Public License for more details.
46 // You should have received a copy of the GNU General Public License
47 // along with Scorched3D; if not, write to the Free Software
48 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
49 ////////////////////////////////////////////////////////////////////////////////
53 my $dir;
54 foreach $dir (@dirs)
56 opendir(IN, "../src/$dir") || die "ERROR: DIR \"$dir\"";
57 my @files = grep { /\.h/ or /\.cpp/ } readdir(IN);
58 closedir(IN);
60 my $file;
61 foreach $file (@files)
63 open (INFILE, "../src/$dir/$file") || die "ERROR: File \"../$dir/$file\"";
64 my @filelines = <INFILE>;
65 close (INFILE);
67 my $lines = join("", @filelines);
68 if ($lines !~ /MERCHANTABILITY or FITNESS/)
70 $lines = $text.$lines;
72 print "../src/$dir/$file\n";
73 open (OUTFILE, ">../src/$dir/$file") || die "ERROR: Out File \"../$dir/$file\"";
74 print OUTFILE $lines;
75 close (OUTFILE);