Fix warning message
[pgp-tools.git] / caff / caff
index 2b5b41e42cb9d9ea16bb5e1ebb5aa894ba95a54b..5d6121ef0d02cef9313112a574f19c6583398af0 100755 (executable)
--- a/caff/caff
+++ b/caff/caff
@@ -116,9 +116,9 @@ The file is generated when it does not exist.
 
 Example:
 
-       $CONFIG{owner} = q{Peter Palfrader};
-       $CONFIG{email} = q{peter@palfrader.org};
-       $CONFIG{keyid} = [ qw{DE7AAF6E94C09C7F 62AF4031C82E0039} ];
+       $CONFIG{'owner'} = q{Peter Palfrader};
+       $CONFIG{'email'} = q{peter@palfrader.org};
+       $CONFIG{'keyid'} = [ qw{DE7AAF6E94C09C7F 62AF4031C82E0039} ];
 
 =head2 Required basic settings
 
@@ -171,7 +171,8 @@ Additional keyids to encrypt messages to. Default: none.
 
 =item B<gpg-sign-args> [string]
 
-Additional arguments to pass to gpg.  Default: none.
+Additional commands to pass to gpg after the "sign" command.
+Default: none.
 
 =head2 Keyserver settings
 
@@ -218,7 +219,7 @@ Do not prompt for sending mail, just do it. Default: B<0>.
 =item B<no-mail> [boolean]
 
 Do not prompt for sending mail. The messages are still written to
-$CONFIG{caffhome}/keys/. Default: B<0>.
+$CONFIG{'caffhome'}/keys/. Default: B<0>.
 
 =item B<mail-template> [string]
 
@@ -256,11 +257,11 @@ Default: none.
 Parameters to pass to Mail::Mailer.
 This could for example be
 
-       $CONFIG{mailer-send} =  [ 'smtp', Server => 'mail.server', Auth => ['user', 'pass'] ]
+       $CONFIG{'mailer-send'} =  [ 'smtp', Server => 'mail.server', Auth => ['user', 'pass'] ];
 
 to use the perl SMTP client or
 
-       $CONFIG{mailer-send} =  [ 'sendmail', '-o8' ]
+       $CONFIG{'mailer-send'} =  [ 'sendmail', '-o8' ];
 
 to pass arguments to the sendmail program.
 For more information run C<< perldoc Mail::Mailer >>.
@@ -776,7 +777,7 @@ sub send_mail($$$@) {
                my ($stdout, $stderr, $status) = readwrite_gpg($message, $inputfd, $stdoutfd, $stderrfd, $statusfd);
                waitpid $pid, 0;
                if ($stdout eq '') {
-                       warn ("No data from gpg for list-key $key_id\n");
+                       warn ("No data from gpg for encrypting mail\n");
                        next;
                };
                $message = $stdout;
@@ -908,8 +909,9 @@ $CONFIG{'mail'}        = $params->{'mail'}        if defined $params->{'mail'};
 $CONFIG{'no-sign'}     = $params->{'no-sign'}     if defined $params->{'no-sign'};
 push @{$CONFIG{'key-files'}}, @{$params->{'key-files'}} if defined $params->{'key-files'};
 
-for my $keyid (@ARGV) {
+for my $keyid (map { split /\n/ } @ARGV) { # caff "`cat txt`" is a single argument
        $keyid =~ s/^0x//i;
+       $keyid =~ s/ //g; # gpg --fingerprint includes spaces
        if ($keyid =~ /^[A-F0-9]{32}$/i) {
                info("Ignoring v3 fingerprint $keyid.  v3 keys are obsolete.");
                next;