[Pgp-tools-commit] r71 - trunk/gpgsigs

Peter Palfrader weasel at costa.debian.org
Mon Jun 20 08:46:50 UTC 2005


Author: weasel
Date: 2005-06-20 08:46:49 +0000 (Mon, 20 Jun 2005)
New Revision: 71

Modified:
   trunk/gpgsigs/gpgsigs
Log:
* Help and version go to stdout when a user asks for them explictly
* Document multiple key usage properly in synopsis
* Extend my copyright statement
* Version is now the svn revision
* Enable Id, Rev keywords
* Set it executable


Modified: trunk/gpgsigs/gpgsigs
===================================================================
--- trunk/gpgsigs/gpgsigs	2005-06-19 13:03:39 UTC (rev 70)
+++ trunk/gpgsigs/gpgsigs	2005-06-20 08:46:49 UTC (rev 71)
@@ -1,5 +1,7 @@
 #!/usr/bin/perl
 
+# $Id$
+
 # See the pod documentation at the end of this file for author,
 # copyright, and licence information.
 #
@@ -16,7 +18,7 @@
 #   * better charset conversion
 #   * pod documentation
 
-my $VERSION = "0.2";
+my $VERSION = '$Rev$';
 
 use strict;
 use warnings;
@@ -25,21 +27,25 @@
 use Getopt::Long;
 
 
-sub version
+sub version($)
 {
-	print STDERR <<EOF;
+	my ($fd) = @_;
+
+	print $fd <<EOF;
 gpgsigs $VERSION - http://pgp-tools.alioth.debian.org/
   (c) 2004 Uli Martens <uli\@youam.net>
-  (c) 2004 Peter Palfrader <peter\@palfrader.org>
+  (c) 2004, 2005 Peter Palfrader <peter\@palfrader.org>
   (c) 2004, 2005 Christoph Berg <cb\@df7cb.de>
 EOF
 }
 
-sub usage
+sub usage($$)
 {
-	version();
-	print STDERR <<EOF;
+	my ($fd, $error) = @_;
 
+	version($fd);
+	print $fd <<EOF;
+
 Usage: $PROGRAM_NAME [-r] [-t <charset>] <keyid> <keytxt> [<outfile>]
 
 keyid is a long or short keyid (e.g. DE7AAF6E94C09C7F or 94C09C7F)
@@ -48,7 +54,7 @@
 -f <charset>  convert <keytxt> from charset
 -t <charset>  convert UIDs to charset in output
 EOF
-	exit shift;
+	exit $error;
 }
 
 
@@ -57,9 +63,9 @@
 	f => \$fromcharset,
 	t => \$charset,
 	r => \$recv_keys,
-	help => sub { usage(0); },
-	version => sub { version(); exit 0;},
-) or usage(1);
+	help => sub { usage(*STDOUT, 0); },
+	version => sub { version(*STDOUT); exit 0;},
+) or usage(*STDERR, 1);
 
 
 # charset conversion
@@ -127,18 +133,18 @@
 
 # parse options
 my $mykey = uc(shift @ARGV);
-my $keytxt = (shift @ARGV) || usage(1);
+my $keytxt = (shift @ARGV) || usage(*STDERR, 1);
 my $outfile = (shift @ARGV) || '-';
 
 my @mykeys = split /,/, $mykey;
 map { s/^0x//i; } @mykeys;
 
 if (!@mykeys || scalar @ARGV) {
-	usage(1);
+	usage(*STDERR, 1);
 }
 if (!grep { /^([0-9A-F]{16,16}|[0-9A-F]{8,8})$/ } @mykeys) {
 	print STDERR "Invalid keyid given\n";
-	usage(1);
+	usage(*STDERR, 1);
 }
 
 -r $keytxt or die ("$keytxt does not exist\n");
@@ -273,7 +279,7 @@
 
 =head1 SYNOPSIS
 
-B<gpgsigs> [-r] [-f I<charset>] [-t I<charset>] I<keyid> F<keytxt> [F<outfile>]
+B<gpgsigs> [-r] [-f I<charset>] [-t I<charset>] I<keyid>I<[>B<,>I<keyidI<[>B<,>I<...>I<]>>I<]> F<keytxt> [F<outfile>]
 
 =head1 DESCRIPTION
 
@@ -303,7 +309,7 @@
 =item I<keyid>
 
 Use this keyid (8 or 16 byte) for annotation. Multiple keyids can be separated
-by I<,>.
+by a comma (B<,>).
 
 =item F<keytxt>
 
@@ -338,7 +344,7 @@
 
 (c) 2004 Uli Martens <uli at youam.net>
 
-(c) 2004 Peter Palfrader <peter at palfrader.org>
+(c) 2004, 2005 Peter Palfrader <peter at palfrader.org>
 
 (c) 2004, 2005 Christoph Berg <cb at df7cb.de>
 


Property changes on: trunk/gpgsigs/gpgsigs
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Id
Rev





More information about the Pgp-tools-commit mailing list