← Commit list

52b971f51

Denys Vlasenko
Denys Vlasenko
2009-10-27
FAILED Duration: 34s

Subject

libbb/ask_confirmation.c: shrink

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/ask_confirmation.c+4 -9
@@ -10,23 +10,18 @@
/* Read a line from stdin. If the first non-whitespace char is 'y' or 'Y',
* return 1. Otherwise return 0.
*/
-
#include "libbb.h"
int FAST_FUNC bb_ask_confirmation(void)
{
- int retval = 0;
- int first = 1;
+ char first = 0;
int c;
while (((c = getchar()) != EOF) && (c != '\n')) {
- if (first && !isspace(c)) {
- --first;
- if ((c == 'y') || (c == 'Y')) {
- ++retval;
- }
+ if (first == 0 && !isblank(c)) {
+ first = c|0x20;
}
}
- return retval;
+ return first == 'y';
}