From: weasel Date: Tue, 19 Jul 2005 23:05:34 +0000 (+0000) Subject: Still print the question, even if we already know the answer X-Git-Url: https://git.sthu.org/?a=commitdiff_plain;h=bc522ce016d83a0211b2cdcc6a0892a81584f7f5;p=pgp-tools.git Still print the question, even if we already know the answer git-svn-id: svn://svn.debian.org/pgp-tools/trunk@136 b513b33f-fedd-0310-b452-c3deb5f4c849 --- diff --git a/caff/caff b/caff/caff index a804dbc..dd74de7 100755 --- 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 = ; chomp $answer; last if ((defined $answer) && (length $answer <= 1));