aboutsummaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2014-09-10 12:59:54 +0100
committerRon Yorston <rmy@pobox.com>2014-09-10 12:59:54 +0100
commit124bbf02948b7ac0babb4ead04acd1559db182d3 (patch)
treea7713365da70b73b3b67aa80bc8fac90edc3bd58 /findutils
parent44be915e702e63af8440902058fc4ad6b3fb1b75 (diff)
downloadbusybox-w32-124bbf02948b7ac0babb4ead04acd1559db182d3.tar.gz
busybox-w32-124bbf02948b7ac0babb4ead04acd1559db182d3.tar.bz2
busybox-w32-124bbf02948b7ac0babb4ead04acd1559db182d3.zip
xargs: read characters directly from console so -p flag works
Diffstat (limited to 'findutils')
-rw-r--r--findutils/xargs.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 76c4747fe..e0fb369e8 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -65,6 +65,9 @@
65 65
66//kbuild:lib-$(CONFIG_XARGS) += xargs.o 66//kbuild:lib-$(CONFIG_XARGS) += xargs.o
67 67
68#if ENABLE_PLATFORM_MINGW32
69#include <conio.h>
70#endif
68#include "libbb.h" 71#include "libbb.h"
69 72
70/* This is a NOEXEC applet. Be very careful! */ 73/* This is a NOEXEC applet. Be very careful! */
@@ -403,13 +406,23 @@ static int xargs_ask_confirmation(void)
403 FILE *tty_stream; 406 FILE *tty_stream;
404 int c, savec; 407 int c, savec;
405 408
409#if !ENABLE_PLATFORM_MINGW32
406 tty_stream = xfopen_for_read(CURRENT_TTY); 410 tty_stream = xfopen_for_read(CURRENT_TTY);
411#endif
407 fputs(" ?...", stderr); 412 fputs(" ?...", stderr);
408 fflush_all(); 413 fflush_all();
414#if !ENABLE_PLATFORM_MINGW32
409 c = savec = getc(tty_stream); 415 c = savec = getc(tty_stream);
410 while (c != EOF && c != '\n') 416 while (c != EOF && c != '\n')
411 c = getc(tty_stream); 417 c = getc(tty_stream);
412 fclose(tty_stream); 418 fclose(tty_stream);
419#else
420 c = savec = getche();
421 while (c != EOF && c != '\r')
422 c = getche();
423 fputs("\n", stderr);
424 fflush_all();
425#endif
413 return (savec == 'y' || savec == 'Y'); 426 return (savec == 'y' || savec == 'Y');
414} 427}
415#else 428#else