Annotation of /tags/mkinitrd-6_2_0/libbb/ask_confirmation.c
Parent Directory | Revision Log
Revision 984 -
(hide annotations)
(download)
Sun May 30 11:32:42 2010 UTC (14 years, 3 months ago) by niro
Original Path: trunk/mkinitrd-magellan/busybox/libbb/ask_confirmation.c
File MIME type: text/plain
File size: 569 byte(s)
Sun May 30 11:32:42 2010 UTC (14 years, 3 months ago) by niro
Original Path: trunk/mkinitrd-magellan/busybox/libbb/ask_confirmation.c
File MIME type: text/plain
File size: 569 byte(s)
-updated to busybox-1.16.1 and enabled blkid/uuid support in default config
1 | niro | 532 | /* vi: set sw=4 ts=4: */ |
2 | /* | ||
3 | * bb_ask_confirmation implementation for busybox | ||
4 | * | ||
5 | * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> | ||
6 | * | ||
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | ||
8 | */ | ||
9 | |||
10 | /* Read a line from stdin. If the first non-whitespace char is 'y' or 'Y', | ||
11 | * return 1. Otherwise return 0. | ||
12 | */ | ||
13 | #include "libbb.h" | ||
14 | |||
15 | niro | 816 | int FAST_FUNC bb_ask_confirmation(void) |
16 | niro | 532 | { |
17 | niro | 984 | char first = 0; |
18 | niro | 532 | int c; |
19 | |||
20 | while (((c = getchar()) != EOF) && (c != '\n')) { | ||
21 | niro | 984 | if (first == 0 && !isblank(c)) { |
22 | first = c|0x20; | ||
23 | niro | 532 | } |
24 | } | ||
25 | |||
26 | niro | 984 | return first == 'y'; |
27 | niro | 532 | } |