summaryrefslogtreecommitdiff
path: root/common/cmd_nand.c
diff options
context:
space:
mode:
authorPierre Aubert <p.aubert@staubli.com>2014-04-24 10:30:07 +0200
committerPantelis Antoniou <panto@antoniou-consulting.com>2014-05-23 11:53:05 +0300
commita5dffa4b67fb0ad635088c9853abf6fcb181ac3c (patch)
tree5fd9cf1fc261a3ad69045731c1ccdfcb0caaa75e /common/cmd_nand.c
parent91fdabc67aebc2468ad362c02449f215e0971c68 (diff)
downloadu-boot-imx-a5dffa4b67fb0ad635088c9853abf6fcb181ac3c.zip
u-boot-imx-a5dffa4b67fb0ad635088c9853abf6fcb181ac3c.tar.gz
u-boot-imx-a5dffa4b67fb0ad635088c9853abf6fcb181ac3c.tar.bz2
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_nand.c')
-rw-r--r--common/cmd_nand.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 04ab0f1..a84f7dc 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -605,22 +605,16 @@ static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
opts.spread = spread;
if (scrub) {
- if (!scrub_yes)
- puts(scrub_warn);
-
- if (scrub_yes)
+ if (scrub_yes) {
opts.scrub = 1;
- else if (getc() == 'y') {
- puts("y");
- if (getc() == '\r')
+ } else {
+ puts(scrub_warn);
+ if (confirm_yesno()) {
opts.scrub = 1;
- else {
+ } else {
puts("scrub aborted\n");
return 1;
}
- } else {
- puts("scrub aborted\n");
- return 1;
}
}
ret = nand_erase_opts(nand, &opts);