From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 6 Jul 2008 13:16:20 +0200 Subject: [U-Boot-Users] [PATCH] add explicit bbt creation to commandline In-Reply-To: <20080706080456.GF4167@prithivi.gnumonks.org> References: <20080706080456.GF4167@prithivi.gnumonks.org> Message-ID: <20080706111620.GC13922@game.jcrosoft.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 16:04 Sun 06 Jul , Harald Welte wrote: > [PATCH] add explicit bbt creation to commandline ("nand createbbt" command) > > This patch adds user-requested BBT creation. It includes the following changes: > > - common/cmd_nand.c: move yes/no decision to separate function > - do_nand: ask for confirmation for "nand erase" > - do_nand: add command "nand createbbt" to erase NAND and create a new BBT > > Signed-off-by: Werner Almesberger > Signed-off-by: Harald Welte > > --- > > diff --git a/common/cmd_nand.c b/common/cmd_nand.c > index bb46f34..2f41157 100644 > --- a/common/cmd_nand.c > +++ b/common/cmd_nand.c > @@ -162,6 +162,17 @@ out: > return 0; > } > > +static int yes(void) > +{ > + char c; > + > + c = getc(); > + if (c != 'y' && c != 'Y') > + return 0; > + c = getc(); > + return c == '\r' || c == '\n'; > +} > + It will be good to have it in a re-usable header as inline. And why not name it as "ask_confirm()"? Best Regards, J.