Still print the question, even if we already know the answer
authorweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Tue, 19 Jul 2005 23:05:34 +0000 (23:05 +0000)
committerweasel <weasel@b513b33f-fedd-0310-b452-c3deb5f4c849>
Tue, 19 Jul 2005 23:05:34 +0000 (23:05 +0000)
git-svn-id: svn://svn.debian.org/pgp-tools/trunk@136 b513b33f-fedd-0310-b452-c3deb5f4c849

caff/caff

index a804dbca3bcbbad5e2eac71b2b3d4f400491fb7e..dd74de713e7d963d779e02de22bdaf3ea679bef3 100755 (executable)
--- a/caff/caff
+++ b/caff/caff
@@ -438,12 +438,22 @@ sub readwrite_gpg($$$$$%) {
 
 sub ask($$;$$) {
        my ($question, $default, $forceyes, $forceno) = @_;
-       return $default if $forceyes and $forceno;
-       return 1 if $forceyes;
-       return 0 if $forceno;
        my $answer;
        while (1) {
                print $question,' ',($default ? '[Y/n]' : '[y/N]'), ' ';
+               if ($forceyes && $forceno) {
+                       print "$default (from config/command line)\n";
+                       return $default;
+               };
+               if ($forceyes) {
+                       print "YES (from config/command line)\n";
+                       return 1;
+               };
+               if ($forceno) {
+                       print "NO (from config/command line)\n";
+                       return 0;
+               };
+
                $answer = <STDIN>;
                chomp $answer;
                last if ((defined $answer) && (length $answer <= 1));