Changeset 2725 in MondoRescue for branches/2.2.9/mindi-busybox/libbb/ask_confirmation.c
- Timestamp:
- Feb 25, 2011, 9:26:54 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mindi-busybox/libbb/ask_confirmation.c
r1765 r2725 5 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 6 6 * 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 8 */ 9 9 … … 11 11 * return 1. Otherwise return 0. 12 12 */ 13 14 13 #include "libbb.h" 15 14 16 int bb_ask_confirmation(void)15 int FAST_FUNC bb_ask_confirmation(void) 17 16 { 18 int retval = 0; 19 int first = 1; 17 char first = 0; 20 18 int c; 21 19 22 20 while (((c = getchar()) != EOF) && (c != '\n')) { 23 /* Make sure we get the actual function call for isspace, 24 * as speed is not critical here. */ 25 if (first && !(isspace)(c)) { 26 --first; 27 if ((c == 'y') || (c == 'Y')) { 28 ++retval; 29 } 21 if (first == 0 && !isblank(c)) { 22 first = c|0x20; 30 23 } 31 24 } 32 25 33 return retval;26 return first == 'y'; 34 27 }
Note:
See TracChangeset
for help on using the changeset viewer.