From 3d0f137894fe06e9d92e3647d9140b0d05867a33 Mon Sep 17 00:00:00 2001 From: Jeremiah Foster Date: Tue, 19 May 2009 20:58:25 +0300 Subject: [PATCH] Added content to index.html and a subroutine called file_tests --- maemian | 30 ++++++++++++++++++++++++++---- www/index.html | 3 ++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/maemian b/maemian index 11d9985..94e4eaf 100755 --- a/maemian +++ b/maemian @@ -40,9 +40,31 @@ use Carp; my $inputfile; # --- A file passed to maemian GetOptions ("inputfile|i=s" => \$inputfile); -if ($inputfile && -x $inputfile) { - print "$inputfile\n"; -} else { - croak "Have you specified an input file?\n $!\n"; +sub file_tests { + use File::Basename; + my $path = shift; + if (-r $path) { + my ($filename, $dirs) = fileparse($path); + if ($filename =~ /maemo/) { + print "W: Any use of the word \"maemo\" is subject to trademark.\n"; + } + + # --- Open file into an array + open my $file, '<', $path or die "Cannot open file: $!\n"; + my @lines = <$file>; + close $file; + + if (grep /BEGIN PGP SIGNED MESSAGE/, @lines) { + print "$filename is signed\n"; + } + # print "\n$dirs\n$filename\n"; + } else { + croak "File not readable: $!\n"; + } } +if ($inputfile) { + file_tests($inputfile); +} else { + croak "No input file found: $!\n"; +} diff --git a/www/index.html b/www/index.html index 4999fe6..2a22f4a 100644 --- a/www/index.html +++ b/www/index.html @@ -6,5 +6,6 @@ -Hello and welcome to Maemian, the policy checker for Maemo. +

Hello and welcome to Maemian, the policy checker for Maemo.

+

You can browse the repo here git repo -- 1.7.9.5