From a5dffa4b67fb0ad635088c9853abf6fcb181ac3c Mon Sep 17 00:00:00 2001 From: Pierre Aubert Date: Thu, 24 Apr 2014 10:30:07 +0200 Subject: 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 Signed-off-by: Pierre Aubert --- common/cmd_fuse.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'common/cmd_fuse.c') diff --git a/common/cmd_fuse.c b/common/cmd_fuse.c index 0df57dbc807..abab9789b0d 100644 --- a/common/cmd_fuse.c +++ b/common/cmd_fuse.c @@ -33,15 +33,8 @@ static int confirm_prog(void) "what you are doing!\n" "\nReally perform this fuse programming? \n"); - if (getc() == 'y') { - int c; - - putc('y'); - c = getc(); - putc('\n'); - if (c == '\r') - return 1; - } + if (confirm_yesno()) + return 1; puts("Fuse programming aborted\n"); return 0; -- cgit v1.2.3