aboutsummaryrefslogtreecommitdiff
path: root/flash_otp_lock.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-05-08 12:27:25 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-07-01 08:55:55 +0300
commitdbe0fd17f2323f108715db0bd0f734e9563e40d8 (patch)
tree0e2342e773045ee2e7f937c1eec5250dbc0810f1 /flash_otp_lock.c
parent8b4786830174e06bc27810f15c76f72cb3e951d9 (diff)
mtd-utils: new prompt() helper for talking to the user
We've got a few tools that prompt the user for "yes/no" questions. Add a common helper to simplify the various implementations. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'flash_otp_lock.c')
-rw-r--r--flash_otp_lock.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/flash_otp_lock.c b/flash_otp_lock.c
index cc8759e..3c39a2d 100644
--- a/flash_otp_lock.c
+++ b/flash_otp_lock.c
@@ -13,11 +13,12 @@
#include <sys/ioctl.h>
#include <mtd/mtd-user.h>
+#include "common.h"
int main(int argc,char *argv[])
{
int fd, val, ret, offset, size;
- char *p, buf[8];
+ char *p;
if (argc != 5 || strcmp(argv[1], "-u")) {
fprintf(stderr, "Usage: %s -u <device> <offset> <size>\n", PROGRAM_NAME);
@@ -53,8 +54,7 @@ int main(int argc,char *argv[])
printf("About to lock OTP user data on %s from 0x%x to 0x%x\n",
argv[2], offset, offset + size);
- printf("Are you sure (yes|no)? ");
- if (fgets(buf, sizeof(buf), stdin) && strcmp(buf, "yes\n") == 0) {
+ if (prompt("Are you sure?", false)) {
struct otp_info info;
info.start = offset;
info.length = size;