OLD | NEW |
1 #!/usr/bin/perl -w | 1 #!/usr/bin/perl -w |
2 # This script was originally based on the script of the same name from | 2 # This script was originally based on the script of the same name from |
3 # the KDE SDK (by dfaure@kde.org) | 3 # the KDE SDK (by dfaure@kde.org) |
4 # | 4 # |
5 # This version is | 5 # This version is |
6 # Copyright (C) 2007, 2008 Adam D. Barratt | 6 # Copyright (C) 2007, 2008 Adam D. Barratt |
| 7 # Copyright (C) 2012 Francesco Poli |
7 # | 8 # |
8 # This program is free software; you can redistribute it and/or modify | 9 # This program is free software; you can redistribute it and/or modify |
9 # it under the terms of the GNU General Public License as published by | 10 # it under the terms of the GNU General Public License as published by |
10 # the Free Software Foundation; either version 2 of the License, or | 11 # the Free Software Foundation; either version 2 of the License, or |
11 # (at your option) any later version. | 12 # (at your option) any later version. |
12 # | 13 # |
13 # This program is distributed in the hope that it will be useful, | 14 # This program is distributed in the hope that it will be useful, |
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 # GNU General Public License for more details. | 17 # GNU General Public License for more details. |
17 # | 18 # |
18 # You should have received a copy of the GNU General Public License along | 19 # You should have received a copy of the GNU General Public License along |
19 # with this program. If not, see <http://www.gnu.org/licenses/>. | 20 # with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | 21 |
21 =head1 NAME | 22 =head1 NAME |
22 | 23 |
23 licensecheck - simple license checker for source files | 24 licensecheck - simple license checker for source files |
24 | 25 |
25 =head1 SYNOPSIS | 26 =head1 SYNOPSIS |
26 | 27 |
27 B<licensecheck> B<--help>|B<--version> | 28 B<licensecheck> B<--help>|B<--version> |
28 | 29 |
29 B<licensecheck> [B<--no-conf>] [B<--verbose>] [B<--copyright>] | 30 B<licensecheck> [B<--no-conf>] [B<--verbose>] [B<--copyright>] |
30 [B<-l>|B<--lines=>I<N>] [B<-i>|B<--ignore=>I<regex>] [B<-c>|B<--check=>I<regex>] | 31 [B<-l>|B<--lines=>I<N>] [B<-i>|B<--ignore=>I<regex>] [B<-c>|B<--check=>I<regex>] |
31 [B<-r>|B<--recursive>] I<list of files and directories to check> | 32 [B<-m>|B<--machine>] [B<-r>|B<--recursive>] |
| 33 I<list of files and directories to check> |
32 | 34 |
33 =head1 DESCRIPTION | 35 =head1 DESCRIPTION |
34 | 36 |
35 B<licensecheck> attempts to determine the license that applies to each file | 37 B<licensecheck> attempts to determine the license that applies to each file |
36 passed to it, by searching the start of the file for text belonging to | 38 passed to it, by searching the start of the file for text belonging to |
37 various licenses. | 39 various licenses. |
38 | 40 |
39 If any of the arguments passed are directories, B<licensecheck> will add | 41 If any of the arguments passed are directories, B<licensecheck> will add |
40 the files contained within to the list of files to process. | 42 the files contained within to the list of files to process. |
41 | 43 |
(...skipping 28 matching lines...) Expand all Loading... |
70 | 72 |
71 Specify a pattern against which filenames will be matched in order to | 73 Specify a pattern against which filenames will be matched in order to |
72 decide which files to check the license of. | 74 decide which files to check the license of. |
73 | 75 |
74 The default includes common source files. | 76 The default includes common source files. |
75 | 77 |
76 =item B<--copyright> | 78 =item B<--copyright> |
77 | 79 |
78 Also display copyright text found within the file | 80 Also display copyright text found within the file |
79 | 81 |
| 82 =item B<-m>, B<--machine> |
| 83 |
| 84 Display the information in a machine readable way, i.e. in the form |
| 85 <file><tab><license>[<tab><copyright>] so that it can be easily sorted |
| 86 and/or filtered, e.g. with the B<awk> and B<sort> commands. |
| 87 Note that using the B<--verbose> option will kill the readability. |
| 88 |
80 =item B<--no-conf>, B<--noconf> | 89 =item B<--no-conf>, B<--noconf> |
81 | 90 |
82 Do not read any configuration files. This can only be used as the first | 91 Do not read any configuration files. This can only be used as the first |
83 option given on the command-line. | 92 option given on the command-line. |
84 | 93 |
85 =back | 94 =back |
86 | 95 |
87 =head1 CONFIGURATION VARIABLES | 96 =head1 CONFIGURATION VARIABLES |
88 | 97 |
89 The two configuration files F</etc/devscripts.conf> and | 98 The two configuration files F</etc/devscripts.conf> and |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 (?:^|/)(?:DEADJOE|\.cvsignore|\.arch-inventory|\.bzrignore|\.gitignore)$| | 157 (?:^|/)(?:DEADJOE|\.cvsignore|\.arch-inventory|\.bzrignore|\.gitignore)$| |
149 # File or directory names that should be ignored | 158 # File or directory names that should be ignored |
150 (?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|\.hg|_darcs|\.git| | 159 (?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|\.hg|_darcs|\.git| |
151 \.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$) | 160 \.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$) |
152 '; | 161 '; |
153 | 162 |
154 # Take out comments and newlines | 163 # Take out comments and newlines |
155 $default_ignore_regex =~ s/^#.*$//mg; | 164 $default_ignore_regex =~ s/^#.*$//mg; |
156 $default_ignore_regex =~ s/\n//sg; | 165 $default_ignore_regex =~ s/\n//sg; |
157 | 166 |
158 my $default_check_regex = '\.(c(c|pp|xx)?|h(h|pp|xx)?|f(77|90)?|p(l|m)|xs|sh|php
|py|rb|java|vala|el|sc(i|e)|cs|pas|inc|dtd|xsl|mod)$'; | 167 my $default_check_regex = '\.(c(c|pp|xx)?|h(h|pp|xx)?|f(77|90)?|p(l|m)|xs|sh|php
|py(|x)|rb|java|vala|el|sc(i|e)|cs|pas|inc|dtd|xsl|mod|m|tex|mli?)$'; |
159 | 168 |
160 my $modified_conf_msg; | 169 my $modified_conf_msg; |
161 | 170 |
162 my ($opt_verbose, $opt_lines, $opt_noconf, $opt_ignore_regex, $opt_check_regex) | 171 my ($opt_verbose, $opt_lines, $opt_noconf, $opt_ignore_regex, $opt_check_regex) |
163 = ('', '', '', '', ''); | 172 = ('', '', '', '', ''); |
164 my $opt_recursive = 0; | 173 my $opt_recursive = 0; |
165 my $opt_copyright = 0; | 174 my $opt_copyright = 0; |
| 175 my $opt_machine = 0; |
166 my ($opt_help, $opt_version); | 176 my ($opt_help, $opt_version); |
167 my $def_lines = 60; | 177 my $def_lines = 60; |
168 | 178 |
169 # Read configuration files and then command line | 179 # Read configuration files and then command line |
170 # This is boilerplate | 180 # This is boilerplate |
171 | 181 |
172 if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) { | 182 if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) { |
173 $modified_conf_msg = " (no configuration files read)"; | 183 $modified_conf_msg = " (no configuration files read)"; |
174 shift; | 184 shift; |
175 } else { | 185 } else { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 221 } |
212 | 222 |
213 GetOptions("help|h" => \$opt_help, | 223 GetOptions("help|h" => \$opt_help, |
214 "version|v" => \$opt_version, | 224 "version|v" => \$opt_version, |
215 "verbose!" => \$opt_verbose, | 225 "verbose!" => \$opt_verbose, |
216 "lines|l=i" => \$opt_lines, | 226 "lines|l=i" => \$opt_lines, |
217 "ignore|i=s" => \$opt_ignore_regex, | 227 "ignore|i=s" => \$opt_ignore_regex, |
218 "recursive|r" => \$opt_recursive, | 228 "recursive|r" => \$opt_recursive, |
219 "check|c=s" => \$opt_check_regex, | 229 "check|c=s" => \$opt_check_regex, |
220 "copyright" => \$opt_copyright, | 230 "copyright" => \$opt_copyright, |
| 231 "machine|m" => \$opt_machine, |
221 "noconf" => \$opt_noconf, | 232 "noconf" => \$opt_noconf, |
222 "no-conf" => \$opt_noconf, | 233 "no-conf" => \$opt_noconf, |
223 ) | 234 ) |
224 or die "Usage: $progname [options] filelist\nRun $progname --help for more d
etails\n"; | 235 or die "Usage: $progname [options] filelist\nRun $progname --help for more d
etails\n"; |
225 | 236 |
226 $opt_lines = $def_lines if $opt_lines !~ /^[1-9][0-9]*$/; | 237 $opt_lines = $def_lines if $opt_lines !~ /^[1-9][0-9]*$/; |
227 $opt_ignore_regex = $default_ignore_regex if ! length $opt_ignore_regex; | 238 $opt_ignore_regex = $default_ignore_regex if ! length $opt_ignore_regex; |
228 $opt_check_regex = $default_check_regex if ! length $opt_check_regex; | 239 $opt_check_regex = $default_check_regex if ! length $opt_check_regex; |
229 | 240 |
230 if ($opt_noconf) { | 241 if ($opt_noconf) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 last if ($. > $opt_lines); | 295 last if ($. > $opt_lines); |
285 $content .= $_; | 296 $content .= $_; |
286 } | 297 } |
287 close(F); | 298 close(F); |
288 | 299 |
289 $copyright = join(" / ", values %copyrights); | 300 $copyright = join(" / ", values %copyrights); |
290 | 301 |
291 print qq(----- $file header -----\n$content----- end header -----\n\n) | 302 print qq(----- $file header -----\n$content----- end header -----\n\n) |
292 if $opt_verbose; | 303 if $opt_verbose; |
293 | 304 |
| 305 # Remove Fortran comments |
| 306 $content =~ s/^[cC] //gm; |
294 $content =~ tr/\t\r\n/ /; | 307 $content =~ tr/\t\r\n/ /; |
295 # Remove C / C++ comments | 308 # Remove C / C++ comments |
296 $content =~ s#(\*/|/[/*])##g; | 309 $content =~ s#(\*/|/[/*])##g; |
297 $content =~ tr% A-Za-z.,@;0-9\(\)/-%%cd; | 310 $content =~ tr% A-Za-z.,@;0-9\(\)/-%%cd; |
298 $content =~ s/ c //g; # Remove fortran comments | |
299 $content =~ tr/ //s; | 311 $content =~ tr/ //s; |
300 | 312 |
301 $license = parselicense($content); | 313 $license = parselicense($content); |
302 print "$file: "; | 314 if ($opt_machine) { |
303 print $license . "\n"; | 315 » print "$file\t$license"; |
304 print " [Copyright: " . $copyright . "]\n" | 316 » print "\t" . ($copyright or "*No copyright*") if $opt_copyright; |
305 if $copyright and $opt_copyright; | 317 » print "\n"; |
306 print "\n" if $opt_copyright; | 318 } else { |
| 319 » print "$file: "; |
| 320 » print "*No copyright* " unless $copyright; |
| 321 » print $license . "\n"; |
| 322 » print " [Copyright: " . $copyright . "]\n" |
| 323 » if $copyright and $opt_copyright; |
| 324 » print "\n" if $opt_copyright; |
| 325 } |
307 } | 326 } |
308 | 327 |
309 sub parse_copyright($) { | 328 sub parse_copyright($) { |
310 my $copyright = ''; | 329 my $copyright = ''; |
311 my $match; | 330 my $match; |
312 | 331 |
313 my $copyright_indicator_regex = ' | 332 my $copyright_indicator_regex = ' |
314 (?:copyright # The full word | 333 (?:copyright # The full word |
315 |copr\. # Legally-valid abbreviation | 334 |copr\. # Legally-valid abbreviation |
316 |\x{00a9} # Unicode character COPYRIGHT SIGN | 335 |\x{00a9} # Unicode character COPYRIGHT SIGN |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 --no-conf, --noconf Don't read devscripts config files; must be | 369 --no-conf, --noconf Don't read devscripts config files; must be |
351 the first option given | 370 the first option given |
352 --verbose Display the header of each file before its | 371 --verbose Display the header of each file before its |
353 license information | 372 license information |
354 --lines, -l Specify how many lines of the file header | 373 --lines, -l Specify how many lines of the file header |
355 should be parsed for license information | 374 should be parsed for license information |
356 (Default: $def_lines) | 375 (Default: $def_lines) |
357 --check, -c Specify a pattern indicating which files should | 376 --check, -c Specify a pattern indicating which files should |
358 be checked | 377 be checked |
359 (Default: '$default_check_regex') | 378 (Default: '$default_check_regex') |
| 379 --machine, -m Display in a machine readable way (good for awk) |
360 --recursive, -r Add the contents of directories recursively | 380 --recursive, -r Add the contents of directories recursively |
361 --copyright Also display the file's copyright | 381 --copyright Also display the file's copyright |
362 --ignore, -i»» Specify that files / directories matching the | 382 --ignore, -i Specify that files / directories matching the |
363 regular expression should be ignored when | 383 regular expression should be ignored when |
364 checking files | 384 checking files |
365 (Default: '$default_ignore_regex') | 385 (Default: '$default_ignore_regex') |
366 | 386 |
367 Default settings modified by devscripts configuration files: | 387 Default settings modified by devscripts configuration files: |
368 $modified_conf_msg | 388 $modified_conf_msg |
369 EOF | 389 EOF |
370 } | 390 } |
371 | 391 |
372 sub version { | 392 sub version { |
373 print <<"EOF"; | 393 print <<"EOF"; |
374 This is $progname, from the Debian devscripts package, version ###VERSION### | 394 This is $progname, from the Debian devscripts package, version ###VERSION### |
375 Copyright (C) 2007, 2008 by Adam D. Barratt <adam\@adam-barratt.org.uk>; based | 395 Copyright (C) 2007, 2008 by Adam D. Barratt <adam\@adam-barratt.org.uk>; based |
376 on a script of the same name from the KDE SDK by <dfaure\@kde.org>. | 396 on a script of the same name from the KDE SDK by <dfaure\@kde.org>. |
377 | 397 |
378 This program comes with ABSOLUTELY NO WARRANTY. | 398 This program comes with ABSOLUTELY NO WARRANTY. |
379 You are free to redistribute this code under the terms of the | 399 You are free to redistribute this code under the terms of the |
380 GNU General Public License, version 2, or (at your option) any | 400 GNU General Public License, version 2, or (at your option) any |
381 later version. | 401 later version. |
382 EOF | 402 EOF |
383 } | 403 } |
384 | 404 |
385 sub parselicense($) { | 405 sub parselicense($) { |
386 my ($licensetext) = @_; | 406 my ($licensetext) = @_; |
387 | 407 |
388 my $gplver = ""; | 408 my $gplver = ""; |
389 my $extrainfo = ""; | 409 my $extrainfo = ""; |
390 my $license = ""; | 410 my $license = ""; |
391 | 411 |
392 if ($licensetext =~ /version ([^ ]+) (?:\(?only\)?.? )?(?:of the GNU (Affero
)?General Public License )?as published by the Free Software Foundation/i or | 412 if ($licensetext =~ /version ([^, ]+?)[.,]? (?:\(?only\)?.? )?(?:of the GNU
(Affero )?(Lesser |Library )?General Public License )?(as )?published by the Fre
e Software Foundation/i or |
393 » $licensetext =~ /GNU (?:Affero )?General Public License as published by
the Free Software Foundation; version ([^ ]+) /i) { | 413 » $licensetext =~ /GNU (?:Affero )?(?:Lesser |Library )?General Public Lic
ense (?:as )?published by the Free Software Foundation; version ([^, ]+?)[.,]? /
i) { |
394 | 414 |
395 $gplver = " (v$1)"; | 415 $gplver = " (v$1)"; |
396 } elsif ($licensetext =~ /GNU (?:Affero ?)General Public License, version ([
^ ]+?)[ .]/) { | 416 } elsif ($licensetext =~ /GNU (?:Affero )?(?:Lesser |Library )?General Publi
c License, version (\d+(?:\.\d+)?)[ \.]/) { |
397 $gplver = " (v$1)"; | 417 $gplver = " (v$1)"; |
398 } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(a
t your option\) any later version/) { | 418 } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(a
t your option\) any later version/) { |
399 $gplver = " (v$1 or later)"; | 419 $gplver = " (v$1 or later)"; |
400 } | 420 } |
401 | 421 |
402 if ($licensetext =~ /permission (?:is (also granted|given))? to link (the co
de of )?this program with (any edition of )?(Qt|the Qt library)/i) { | 422 if ($licensetext =~ /permission (?:is (also granted|given))? to link (the co
de of )?this program with (any edition of )?(Qt|the Qt library)/i) { |
403 $extrainfo = " (with Qt exception)$extrainfo" | 423 $extrainfo = " (with Qt exception)$extrainfo" |
404 } | 424 } |
405 | 425 |
406 if ($licensetext =~ /(All changes made in this file will be lost|DO NOT (EDI
T|delete this file)|Generated (automatically|by|from)|generated.*file)/i) { | 426 if ($licensetext =~ /(All changes made in this file will be lost|DO NOT (EDI
T|delete this file)|Generated (automatically|by|from)|generated.*file)/i) { |
407 $license = "GENERATED FILE"; | 427 $license = "GENERATED FILE"; |
408 } | 428 } |
409 | 429 |
410 if ($licensetext =~ /is free software.? you can redistribute it and\/or modi
fy it under the terms of the (GNU (Library|Lesser) General Public License|LGPL)/
i) { | 430 if ($licensetext =~ /is (free software.? you can redistribute it and\/or mod
ify it|licensed) under the terms of (version [^ ]+ of )?the (GNU (Library |Lesse
r )General Public License|LGPL)/i) { |
411 $license = "LGPL$gplver$extrainfo $license"; | 431 $license = "LGPL$gplver$extrainfo $license"; |
412 } | 432 } |
413 | 433 |
414 if ($licensetext =~ /is free software.? you (can|may) redistribute it and\/o
r modify it under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU Gen
eral Public License/i) { | 434 if ($licensetext =~ /is free software.? you (can|may) redistribute it and\/o
r modify it under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU Gen
eral Public License/i) { |
415 $license = "GPL$gplver$extrainfo $license"; | 435 $license = "GPL$gplver$extrainfo $license"; |
416 } elsif ($licensetext =~ /is distributed under the terms of the GNU General
Public License,/ | 436 } elsif ($licensetext =~ /is distributed under the terms of the GNU General
Public License,/ |
417 and length $gplver) { | 437 and length $gplver) { |
418 $license = "GPL$gplver$extrainfo $license"; | 438 $license = "GPL$gplver$extrainfo $license"; |
419 } elsif ($licensetext =~ /is distributed.*terms.*GPL/) { | 439 } elsif ($licensetext =~ /is distributed.*terms.*GPL/) { |
420 $license = "GPL (unversioned/unknown version) $license"; | 440 $license = "GPL (unversioned/unknown version) $license"; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 if ($licensetext =~ /This program is free software; you can redistribute it
and\/or modify it under the same terms as Perl itself/) { | 496 if ($licensetext =~ /This program is free software; you can redistribute it
and\/or modify it under the same terms as Perl itself/) { |
477 $license = "Perl $license"; | 497 $license = "Perl $license"; |
478 } | 498 } |
479 | 499 |
480 if ($licensetext =~ /under the terms of the Apache ([^ ]+) License OR versio
n 2 of the GNU/) { | 500 if ($licensetext =~ /under the terms of the Apache ([^ ]+) License OR versio
n 2 of the GNU/) { |
481 $license = "Apache (v$1) GPL (v2) $license"; | 501 $license = "Apache (v$1) GPL (v2) $license"; |
482 } elsif ($licensetext =~ /under the Apache License, Version ([^ ]+)/) { | 502 } elsif ($licensetext =~ /under the Apache License, Version ([^ ]+)/) { |
483 $license = "Apache (v$1) $license"; | 503 $license = "Apache (v$1) $license"; |
484 } | 504 } |
485 | 505 |
| 506 if ($licensetext =~ /(THE BEER-WARE LICENSE)/i) { |
| 507 $license = "Beerware $license"; |
| 508 } |
| 509 |
486 if ($licensetext =~ /This source file is subject to version ([^ ]+) of the P
HP license/) { | 510 if ($licensetext =~ /This source file is subject to version ([^ ]+) of the P
HP license/) { |
487 $license = "PHP (v$1) $license"; | 511 $license = "PHP (v$1) $license"; |
488 } | 512 } |
489 | 513 |
490 if ($licensetext =~ /under the terms of the CeCILL /) { | 514 if ($licensetext =~ /under the terms of the CeCILL /) { |
491 $license = "CeCILL $license"; | 515 $license = "CeCILL $license"; |
492 } | 516 } |
493 | 517 |
494 if ($licensetext =~ /under the terms of the CeCILL-([^ ]+) /) { | 518 if ($licensetext =~ /under the terms of the CeCILL-([^ ]+) /) { |
495 $license = "CeCILL-$1 $license"; | 519 $license = "CeCILL-$1 $license"; |
496 } | 520 } |
497 | 521 |
498 if ($licensetext =~ /under the SGI Free Software (B License|License B)/) { | 522 if ($licensetext =~ /under the SGI Free Software (B License|License B)/) { |
499 $license = "SGI Free Software License B $license"; | 523 $license = "SGI Free Software License B $license"; |
500 } | 524 } |
501 | 525 |
502 if ($licensetext =~ /in the public domain/i) { | 526 if ($licensetext =~ /in the public domain/i) { |
503 » $license = "Public domain"; | 527 » $license = "Public domain $license"; |
504 } | 528 } |
505 | 529 |
506 if ($licensetext =~ /terms of the Common Development and Distribution Licens
e(, Version ([^(]+))? \(the License\)/) { | 530 if ($licensetext =~ /terms of the Common Development and Distribution Licens
e(, Version ([^(]+))? \(the License\)/) { |
507 $license = "CDDL " . ($1 ? "(v$2) " : '') . $license; | 531 $license = "CDDL " . ($1 ? "(v$2) " : '') . $license; |
508 } | 532 } |
509 | 533 |
510 if ($licensetext =~ /Microsoft Permissive License \(Ms-PL\)/) { | 534 if ($licensetext =~ /Microsoft Permissive License \(Ms-PL\)/) { |
511 $license = "Ms-PL $license"; | 535 $license = "Ms-PL $license"; |
512 } | 536 } |
513 | 537 |
(...skipping 27 matching lines...) Expand all Loading... |
541 if ($licensetext =~ /As a special exception, you may create a larger work th
at contains part or all of the Bison parser skeleton and distribute that work un
der terms of your choice/) { | 565 if ($licensetext =~ /As a special exception, you may create a larger work th
at contains part or all of the Bison parser skeleton and distribute that work un
der terms of your choice/) { |
542 $license = $license . "with Bison parser exception"; | 566 $license = $license . "with Bison parser exception"; |
543 } | 567 } |
544 | 568 |
545 if ($licensetext =~ /As a special exception to the GNU General Public Licens
e, if you distribute this file as part of a program or library that is built usi
ng GNU Libtool, you may include this file under the same distribution terms that
you use for the rest of that program/) { | 569 if ($licensetext =~ /As a special exception to the GNU General Public Licens
e, if you distribute this file as part of a program or library that is built usi
ng GNU Libtool, you may include this file under the same distribution terms that
you use for the rest of that program/) { |
546 $license = $license . "with libtool exception"; | 570 $license = $license . "with libtool exception"; |
547 } | 571 } |
548 | 572 |
549 $license = "UNKNOWN" if (!length($license)); | 573 $license = "UNKNOWN" if (!length($license)); |
550 | 574 |
| 575 # Remove trailing spaces. |
| 576 $license =~ s/\s+$//; |
| 577 |
551 return $license; | 578 return $license; |
552 } | 579 } |
553 | 580 |
554 sub fatal($) { | 581 sub fatal($) { |
555 my ($pack,$file,$line); | 582 my ($pack,$file,$line); |
556 ($pack,$file,$line) = caller(); | 583 ($pack,$file,$line) = caller(); |
557 (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d; | 584 (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d; |
558 $msg =~ s/\n\n$/\n/; | 585 $msg =~ s/\n\n$/\n/; |
559 die $msg; | 586 die $msg; |
560 } | 587 } |
OLD | NEW |