aboutsummaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-09-30 00:00:43 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2020-09-30 00:00:43 +0200
commitbd202a5ec15b82ba9562cdd81157e703349d8459 (patch)
tree6ecc199048004f741144bbbf9c5b3561f6161d57 /findutils
parentd4dd48f2948b006f4ccb7cc2b603fb3d00f90685 (diff)
downloadbusybox-w32-bd202a5ec15b82ba9562cdd81157e703349d8459.tar.gz
busybox-w32-bd202a5ec15b82ba9562cdd81157e703349d8459.tar.bz2
busybox-w32-bd202a5ec15b82ba9562cdd81157e703349d8459.zip
xargs: fix -I SUBSTR behaviour
function old new delta process_stdin_with_replace 165 204 +39 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'findutils')
-rw-r--r--findutils/xargs.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/findutils/xargs.c b/findutils/xargs.c
index ff04bfe7c..e2b3527f3 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -80,9 +80,11 @@
80/* This is a NOEXEC applet. Be very careful! */ 80/* This is a NOEXEC applet. Be very careful! */
81 81
82 82
83//#define dbg_msg(...) bb_error_msg(__VA_ARGS__) 83#if 0
84#define dbg_msg(...) ((void)0) 84# define dbg_msg(...) bb_error_msg(__VA_ARGS__)
85 85#else
86# define dbg_msg(...) ((void)0)
87#endif
86 88
87#ifdef TEST 89#ifdef TEST
88# ifndef ENABLE_FEATURE_XARGS_SUPPORT_CONFIRMATION 90# ifndef ENABLE_FEATURE_XARGS_SUPPORT_CONFIRMATION
@@ -466,9 +468,18 @@ static char* FAST_FUNC process_stdin_with_replace(int n_max_chars, int n_max_arg
466 468
467 while (1) { 469 while (1) {
468 int c = getchar(); 470 int c = getchar();
471 if (p == buf) {
472 if (c == EOF)
473 goto ret; /* last line is empty, return "" */
474 if (c == G.eol_ch)
475 continue; /* empty line, ignore */
476 /* Skip leading whitespace of each line: try
477 * echo -e ' \t\v1 2 3 ' | xargs -I% echo '[%]'
478 */
479 if (ISSPACE(c))
480 continue;
481 }
469 if (c == EOF || c == G.eol_ch) { 482 if (c == EOF || c == G.eol_ch) {
470 if (p == buf)
471 goto ret; /* empty line */
472 c = '\0'; 483 c = '\0';
473 } 484 }
474 *p++ = c; 485 *p++ = c;