X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=maemian;h=94e4eaf10d02d7115bccbf59e11e90dcb0cc05d9;hb=3d0f137894fe06e9d92e3647d9140b0d05867a33;hp=11d9985531a4bc855dd6803652e0fdfb830e3554;hpb=1930cf87f0485301b2895727be80c4f4b0e37982;p=maemian 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"; +}