#!/usr/bin/perl -Tw
# Written by Jonathan McDowell <noodles@earth.li>
# Copyright 2000 Project Purple.
# Dedicated to linguists called Simon everywhere.
#
# Processes the output of gpg -v --list-keys to a format gpgstats likes.
#
# Try:
# gpg -v --list-keys | ./gpgpre | uniq > keyfile
#
# I should really include the uniq in the code.

use strict;

my ($curline);

while ($curline = <>) {
	chomp $curline;

	if ($curline =~ /^pub.*\/([0-9a-fA-F]{8}) [0-9-\/]{10} (.*)/) {
		print "P$1\n";
		print "N$2\n";
	} elsif ($curline =~ /^sig *([0-9a-fA-F]{8})/) {
		print "S$1\n";
	}
}