summaryrefslogtreecommitdiff
path: root/bin/ninka
blob: 1f98eb2c2fad8b36ddefa5c2b7562ed36f117be5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/perl

use strict;
use warnings;
use Getopt::Std;
use Ninka;

my %opts = parse_cmdline_parameters();
my $create_intermediary_files = exists $opts{i};
my $verbose = exists $opts{v};

foreach my $input_file (@ARGV) {
    my $license_result = Ninka::process_file($input_file, $create_intermediary_files, $verbose);
    print "$input_file;$license_result\n";
}
exit 0;

sub parse_cmdline_parameters {
    my %opts = ();
    if (!getopts('iv', \%opts) || scalar(@ARGV) == 0) {
        print STDERR "Ninka v${Ninka::VERSION}

Usage: ninka [options] <filename>...

Options:
  -i create intermediary files
  -v verbose\n";

        exit 1;
    }
    return %opts;
}

__END__

=encoding utf8

=head1 NAME

ninka - source file license identification tool

=head1 SYNOPSYS

B<ninka> [options] F<filename>...

=head1 DESCRIPTION

Scans a source file and returns the found licenses.

=head1 OPTIONS

=over

=item B<-i>

create intermediary files (for debugging)

=item B<-v>

verbose

=back

=head1 EXAMPLES

=over

=item B<ninka> F<foo.c>

Determine the licenses in file F<foo.c>.

=item B<ninka -i> F<foo.c>

Determine the licenses in file F<foo.c> and create intermediary files (for debugging).

=item find * -type f -print | xargs -I@ B<ninka> '@'

Determine the licenses of files in a directory.

=back

=head1 AUTHOR

B<ninka> was written by Daniel M. German <dmg@uvic.ca> and Yuki Manabe <y-manabe@ist.osaka-u.ac.jp>.

=head1 SEE ALSO

Daniel M. German, Yuki Manabe and Katsuro Inoue. A sentence-matching method
for automatic license identification of source code files. In 25nd IEEE/ACM
International Conference on Automated Software Engineering (ASE 2010).

You can download it from http://turingmachine.org/~dmg/papers/dmg2010ninka.pdf.

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2009-2014  Yuki Manabe and Daniel M. German, 2015 René Scheibe

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

=cut