summaryrefslogtreecommitdiff
path: root/findutils/xargs.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-08-03 19:12:25 +0000
committerDenis Vlasenko2008-08-03 19:12:25 +0000
commitcc08ad26fe371e0b0bdbc58343c1f33a8840d2a0 (patch)
tree104e98b094551d4705b5a690a5d8d8c960cb44e3 /findutils/xargs.c
parent1e28f6171fe9cb56422473d506aa28fdb1eb46d8 (diff)
downloadbusybox-cc08ad26fe371e0b0bdbc58343c1f33a8840d2a0.zip
busybox-cc08ad26fe371e0b0bdbc58343c1f33a8840d2a0.tar.gz
xargs: fix xargs -e; added test for that
Diffstat (limited to 'findutils/xargs.c')
-rw-r--r--findutils/xargs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 8f0a3d4..92d01f7 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -376,6 +376,8 @@ enum {
int xargs_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int xargs_main(int argc, char **argv)
{
+ static const char const_eof_str[] ALIGN1 = "_";
+
char **args;
int i, n;
xlist_t *list = NULL;
@@ -385,7 +387,7 @@ int xargs_main(int argc, char **argv)
int n_max_arg;
size_t n_chars = 0;
long orig_arg_max;
- const char *eof_str = "_";
+ const char *eof_str = const_eof_str;
unsigned opt;
size_t n_max_chars;
#if ENABLE_FEATURE_XARGS_SUPPORT_ZERO_TERM
@@ -396,6 +398,10 @@ int xargs_main(int argc, char **argv)
opt = getopt32(argv, OPTION_STR, &max_args, &max_chars, &eof_str);
+ /* -e without optional param? */
+ if ((opt & OPT_EOF_STRING) && eof_str == const_eof_str)
+ eof_str = NULL;
+
if (opt & OPT_ZEROTERM)
USE_FEATURE_XARGS_SUPPORT_ZERO_TERM(read_args = process0_stdin);