From bc522ce016d83a0211b2cdcc6a0892a81584f7f5 Mon Sep 17 00:00:00 2001 From: weasel Date: Tue, 19 Jul 2005 23:05:34 +0000 Subject: [PATCH] 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 --- caff/caff | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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)); -- 2.39.5