mirror of
https://xff.cz/git/u-boot/
synced 2025-11-01 19:05:51 +01:00
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>
This commit is contained in:
committed by
Pantelis Antoniou
parent
91fdabc67a
commit
a5dffa4b67
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user