diff options
author | Pierre Aubert <p.aubert@staubli.com> | 2014-04-24 10:30:07 +0200 |
---|---|---|
committer | Pantelis Antoniou <panto@antoniou-consulting.com> | 2014-05-23 11:53:05 +0300 |
commit | a5dffa4b67fb0ad635088c9853abf6fcb181ac3c (patch) | |
tree | 5fd9cf1fc261a3ad69045731c1ccdfcb0caaa75e /common/cmd_otp.c | |
parent | 91fdabc67aebc2468ad362c02449f215e0971c68 (diff) | |
download | u-boot-midas-a5dffa4b67fb0ad635088c9853abf6fcb181ac3c.tar.gz u-boot-midas-a5dffa4b67fb0ad635088c9853abf6fcb181ac3c.tar.bz2 u-boot-midas-a5dffa4b67fb0ad635088c9853abf6fcb181ac3c.zip |
Add the function 'confirm_yesno' for interactive
User's confirmation is asked in different commands. This commit adds a
function for such confirmation.
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
Signed-off-by: Pierre Aubert <p.aubert@staubli.com>
Diffstat (limited to 'common/cmd_otp.c')
-rw-r--r-- | common/cmd_otp.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/common/cmd_otp.c b/common/cmd_otp.c index 67808aa377..593bb8c650 100644 --- a/common/cmd_otp.c +++ b/common/cmd_otp.c @@ -158,21 +158,9 @@ int do_otp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) lowup(half + count - 1), page + (half + count - 1) / 2, half + count ); - - i = 0; - while (1) { - if (tstc()) { - const char exp_ans[] = "YES\r"; - char c; - putc(c = getc()); - if (exp_ans[i++] != c) { - printf(" Aborting\n"); - return 1; - } else if (!exp_ans[i]) { - puts("\n"); - break; - } - } + if (!confirm_yesno()) { + printf(" Aborting\n"); + return 1; } } |