Added content to index.html and a subroutine called file_tests
[maemian] / maemian
1 #!/usr/bin/perl
2
3 # Copyright (C) Jeremiah C. Foster 2009, based on:
4
5 #   Lintian -- Debian package checker
6 # Copyright (C) 1998 Christian Schwarz and Richard Braakman
7
8 # This program is free software.  It is distributed under the terms of
9 # the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any
11 # later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program.  If not, you can find it on the World Wide
20 # Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
21 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 # MA 02110-1301, USA.
23
24 =head1 NAME
25
26 maemian - Maemo package checker
27
28 =head1 EXAMPLE
29
30 maemian -i file.dsc
31
32 =cut
33
34 use strict;
35 use warnings;
36 use Getopt::Long;
37 use Carp;
38
39 # --- Command line options
40 my $inputfile;             # --- A file passed to maemian 
41 GetOptions ("inputfile|i=s" => \$inputfile);
42
43 sub file_tests {
44   use File::Basename;
45   my $path = shift;
46   if (-r $path) {
47     my ($filename, $dirs) = fileparse($path);
48     if ($filename =~ /maemo/) {
49       print "W: Any use of the word \"maemo\" is subject to trademark.\n";
50     }
51
52     # --- Open file into an array
53     open my $file, '<', $path or die "Cannot open file: $!\n";
54     my @lines = <$file>;
55     close $file;
56
57     if (grep /BEGIN PGP SIGNED MESSAGE/, @lines) {
58       print "$filename is signed\n";
59     }
60     # print "\n$dirs\n$filename\n";
61   } else {
62     croak "File not readable: $!\n";
63   }
64 }
65
66 if ($inputfile) {
67   file_tests($inputfile);
68 } else {
69   croak "No input file found: $!\n";
70 }