aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-03-03 09:51:57 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-03-03 09:51:57 +0100
commit7cfe6ea99e78f82b068216faac4739eaaebaaa8b (patch)
tree19296018221fcb40efdfe102f1cdbd693d09e1a4
parent1df0af76700c7f75ea43006ad6d450cdeeb6244f (diff)
downloadbusybox-w32-7cfe6ea99e78f82b068216faac4739eaaebaaa8b.tar.gz
busybox-w32-7cfe6ea99e78f82b068216faac4739eaaebaaa8b.tar.bz2
busybox-w32-7cfe6ea99e78f82b068216faac4739eaaebaaa8b.zip
xargs: support --no-run-if-empty (synonym to -r)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--findutils/xargs.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 0ec80f809..967737133 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -15,10 +15,6 @@
15 * http://www.opengroup.org/onlinepubs/007904975/utilities/xargs.html 15 * http://www.opengroup.org/onlinepubs/007904975/utilities/xargs.html
16 */ 16 */
17 17
18//applet:IF_XARGS(APPLET_NOEXEC(xargs, xargs, BB_DIR_USR_BIN, BB_SUID_DROP, xargs))
19
20//kbuild:lib-$(CONFIG_XARGS) += xargs.o
21
22//config:config XARGS 18//config:config XARGS
23//config: bool "xargs" 19//config: bool "xargs"
24//config: default y 20//config: default y
@@ -58,6 +54,10 @@
58//config: instead of whitespace, and the quotes and backslash 54//config: instead of whitespace, and the quotes and backslash
59//config: are not special. 55//config: are not special.
60 56
57//applet:IF_XARGS(APPLET_NOEXEC(xargs, xargs, BB_DIR_USR_BIN, BB_SUID_DROP, xargs))
58
59//kbuild:lib-$(CONFIG_XARGS) += xargs.o
60
61#include "libbb.h" 61#include "libbb.h"
62 62
63/* This is a NOEXEC applet. Be very careful! */ 63/* This is a NOEXEC applet. Be very careful! */
@@ -89,7 +89,9 @@ struct globals {
89 int idx; 89 int idx;
90} FIX_ALIASING; 90} FIX_ALIASING;
91#define G (*(struct globals*)&bb_common_bufsiz1) 91#define G (*(struct globals*)&bb_common_bufsiz1)
92#define INIT_G() do { } while (0) 92#define INIT_G() do { \
93 G.eof_str = NULL; /* need to clear by hand because we are NOEXEC applet */ \
94} while (0)
93 95
94 96
95/* 97/*
@@ -412,7 +414,12 @@ int xargs_main(int argc, char **argv)
412 414
413 INIT_G(); 415 INIT_G();
414 416
415 G.eof_str = NULL; 417#if ENABLE_DESKTOP && ENABLE_LONG_OPTS
418 /* For example, Fedora's build system uses --no-run-if-empty */
419 applet_long_options =
420 "no-run-if-empty\0" No_argument "r"
421 ;
422#endif
416 opt = getopt32(argv, OPTION_STR, &max_args, &max_chars, &G.eof_str, &G.eof_str); 423 opt = getopt32(argv, OPTION_STR, &max_args, &max_chars, &G.eof_str, &G.eof_str);
417 424
418 /* -E ""? You may wonder why not just omit -E? 425 /* -E ""? You may wonder why not just omit -E?