File indexing completed on 2024-03-24 05:44:51

0001 #!/usr/bin/perl -w
0002 
0003 eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
0004     if 0; # not running under some shell
0005 
0006 ###############################################################################
0007 # A wrapper for the Krazy license checker to replace the old licensecheck     #
0008 #                                                                             #
0009 # Copyright 2008 by Allen Winter <winter@kde.org>                             #
0010 #                                                                             #
0011 # This program is free software; you can redistribute it and/or modify        #
0012 # it under the terms of the GNU General Public License as published by        #
0013 # the Free Software Foundation; either version 2 of the License, or           #
0014 # (at your option) any later version.                                         #
0015 #                                                                             #
0016 # This program is distributed in the hope that it will be useful,             #
0017 # but WITHOUT ANY WARRANTY; without even the implied warranty of              #
0018 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the                #
0019 # GNU General Public License for more details.                                #
0020 #                                                                             #
0021 # You should have received a copy of the GNU General Public License along     #
0022 # with this program; if not, write to the Free Software Foundation, Inc.,     #
0023 # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.               #
0024 #                                                                             #
0025 ###############################################################################
0026 
0027 use strict;
0028 use Env qw(PATH);
0029 use File::Find;
0030 
0031 my($krazyPath) = "";
0032 
0033 # Generate an array of paths to search for plugins
0034 my ($kp,@paths,@tmp);
0035 for $kp ( split( /:/, $PATH ) ) {
0036   push( @paths, $kp ) if ( -d $kp );
0037 }
0038 if ($#paths >= 0) {
0039   @tmp = ();
0040   find( \&buildKList, @paths );
0041 
0042   sub buildKList {
0043     -x && !-d && $_ =~ /krazy2$/ && push(@tmp,$File::Find::name);
0044   }
0045 }
0046 for $kp (@tmp) {
0047   if ($kp =~ m+/bin/krazy2$+) {
0048     $krazyPath = $kp;
0049     $krazyPath =~ s+/bin/krazy2$++g;
0050     last;
0051   }
0052 }
0053 
0054 if ($krazyPath eq "") {
0055   print "Cannot find krazy2 executable in your \$PATH. Sorry.\n";
0056   exit 1;
0057 }
0058 
0059 my($licenseCheckerPath) = $krazyPath . "/lib/krazy2/krazy-plugins/c++/license";
0060 
0061 system("$licenseCheckerPath --verbose @ARGV");
0062 
0063