aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-12-25 21:24:57 -0800
committerRob Landley <rob@landley.net>2017-12-26 20:45:14 -0600
commit70a6c55499eabf1229dfb0b49f08b366cbaa7896 (patch)
tree48ba3af3e48738c7dfe10b0d25b8475e715a1ea2 /toys
parent4335501bf3269ac86b7bfdf236aa763d380327e2 (diff)
downloadtoybox-70a6c55499eabf1229dfb0b49f08b366cbaa7896.tar.gz
Fix xargs -0 with -n.
Also make -0 and -E mutually exclusive (rather than just ignore -E with -0). Bug: https://github.com/landley/toybox/issues/78
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/xargs.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/toys/posix/xargs.c b/toys/posix/xargs.c
index e7dd10b5..cac143cc 100644
--- a/toys/posix/xargs.c
+++ b/toys/posix/xargs.c
@@ -6,7 +6,7 @@
*
* TODO: Rich's whitespace objection, env size isn't fixed anymore.
-USE_XARGS(NEWTOY(xargs, "^I:E:L#ptxrn#<1s#0", TOYFLAG_USR|TOYFLAG_BIN))
+USE_XARGS(NEWTOY(xargs, "^I:E:L#ptxrn#<1s#0[!0E]", TOYFLAG_USR|TOYFLAG_BIN))
config XARGS
bool "xargs"
@@ -99,8 +99,7 @@ static char *handle_entries(char *data, char **entry)
} else {
TT.bytes += sizeof(char *)+strlen(data)+1;
if (TT.max_bytes && TT.bytes >= TT.max_bytes) return data;
- if (TT.max_entries && TT.entries >= TT.max_entries)
- return (char *)1;
+ if (TT.max_entries && TT.entries >= TT.max_entries) return data;
if (entry) entry[TT.entries] = data;
TT.entries++;
}