handle revoked uids in perl to get linecount right
[pgp-tools.git] / gpg-key2ps / gpg-key2ps
index c8e58fa57cc403a61fc51331cc3020dac41a89ee..9498e6b04bac513d23f262e80353efb99b0be9cb 100755 (executable)
@@ -85,6 +85,7 @@ if ( -x "/usr/bin/paperconf" ) {
        chomp($h);
 } else {
        # Default to A4.
+       print STDERR "Warning: libpaper-utils is not installed, defaulting to A4.\n";
        $w=596;
        $h=842;
 }
@@ -164,8 +165,6 @@ if ( $revokestyle eq "grey" ) {
        print " uid\n";
        print " 0 setgray\n";
        print "} def\n";
-} elsif ( $revokestyle eq "hide" ) {
-       print "/revuid {} def\n";
 } elsif ( $revokestyle eq "note" ) {
        print "/revuid {\n";
        print " 50 y moveto (uid) show\n";
@@ -222,7 +221,9 @@ while(<GPG>) {
        # user ids
        s/^uid:[^:r]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:([^:]*):.*/     ($1) uid/;
        # revoked user id
-       s/^uid:r[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:([^:]*):.*/     ($1) revuid/;
+       if (s/^uid:r[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:([^:]*):.*/ ($1) revuid/) {
+               next if $revokestyle eq "hide";
+       }
        # subkey
        s/^sub:[^:]*:([^:]*):([0-9]*):.{8,8}(.{8,8}):([^:]*):[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:.*/    ($4) ($3) $2 ($1) sbk/;
        $numlines++;
@@ -236,6 +237,8 @@ unless ($started) {
        exit 1;
 }
 
+print STDERR "numlines $numlines\n";
+
 # output the remaining postscript
 print <<EOF;
 } def