check-message-conformance.pm
changeset 0 f9d48a4c1068
equal deleted inserted replaced
-1:000000000000 0:f9d48a4c1068
       
     1 use Fcntl qw/:seek/;
       
     2 
       
     3 my $sig_pattern = qr/
       
     4 	^--\x20\s+	# signature delimiter dash-dash-space
       
     5 	^Heiko\s+	# signature text
       
     6 	\Z		# hard end of the signature
       
     7 /mix;
       
     8 
       
     9 sub check_sig {
       
    10 	my ($file, $sender) = @_;
       
    11 	
       
    12 	open(my $fh, $file) or die "Can't open $file: $!\n";
       
    13 	seek($fh, -1024, SEEK_END) or die "Can't seek to -1024: $!\n"
       
    14 		if -s $fh > 1024;
       
    15 
       
    16 	$_ = join '', <$fh>;
       
    17 
       
    18 	return /$sig_pattern/;
       
    19 }