Last change
on this file since 2866 was 2725, checked in by Bruno Cornec, 13 years ago |
- Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
|
File size:
561 bytes
|
Rev | Line | |
---|
[821] | 1 | /* 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 | *
|
---|
[2725] | 7 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
[821] | 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 |
|
---|
[2725] | 15 | int FAST_FUNC bb_ask_confirmation(void)
|
---|
[821] | 16 | {
|
---|
[2725] | 17 | char first = 0;
|
---|
[821] | 18 | int c;
|
---|
| 19 |
|
---|
| 20 | while (((c = getchar()) != EOF) && (c != '\n')) {
|
---|
[2725] | 21 | if (first == 0 && !isblank(c)) {
|
---|
| 22 | first = c|0x20;
|
---|
[821] | 23 | }
|
---|
| 24 | }
|
---|
| 25 |
|
---|
[2725] | 26 | return first == 'y';
|
---|
[821] | 27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.