summaryrefslogtreecommitdiff
path: root/util-linux/fsck_minix.c
diff options
context:
space:
mode:
authorDenys Vlasenko2009-10-29 13:27:31 +0100
committerDenys Vlasenko2009-10-29 13:27:31 +0100
commit85ca327529afeceed41c1d66d0b7d48c2ffc2a4b (patch)
treeaddba6c780c2d0318f7091afb80e9be90f900ad0 /util-linux/fsck_minix.c
parent1f6d2307bafd1e55addac5fc28a71f59fc3bd5ba (diff)
downloadbusybox-85ca327529afeceed41c1d66d0b7d48c2ffc2a4b.zip
busybox-85ca327529afeceed41c1d66d0b7d48c2ffc2a4b.tar.gz
*: random code shrink
function old new delta alarm_handler 50 46 -4 ask 228 211 -17 rtcwake_main 474 455 -19 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/fsck_minix.c')
-rw-r--r--util-linux/fsck_minix.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 5d1d2af..cdd3060 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -341,22 +341,24 @@ static int ask(const char *string, int def)
}
printf(def ? "%s (y/n)? " : "%s (n/y)? ", string);
for (;;) {
- fflush(stdout);
+ fflush(NULL);
c = getchar();
if (c == EOF) {
if (!def)
errors_uncorrected = 1;
return def;
}
- c = toupper(c);
- if (c == 'Y') {
+ if (c == '\n')
+ break;
+ c |= 0x20; /* tolower */
+ if (c == 'y') {
def = 1;
break;
- } else if (c == 'N') {
+ }
+ if (c == 'n') {
def = 0;
break;
- } else if (c == ' ' || c == '\n')
- break;
+ }
}
if (def)
printf("y\n");