aboutsummaryrefslogtreecommitdiff
path: root/findutils
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 11:41:16 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-14 11:41:16 +1000
commit743d85e7d1c2a721baf020b9d79f45f0df2420a9 (patch)
tree9e551b726ac2bf9fd8eafb2764e7237f352bb429 /findutils
parent87911f4fcd86f7abc0aefba8e9cbec2ac9d127e4 (diff)
parentc7f95d23f6bc7e17a3b79decf83eb362b389e53a (diff)
downloadbusybox-w32-743d85e7d1c2a721baf020b9d79f45f0df2420a9.tar.gz
busybox-w32-743d85e7d1c2a721baf020b9d79f45f0df2420a9.tar.bz2
busybox-w32-743d85e7d1c2a721baf020b9d79f45f0df2420a9.zip
Merge branch 'origin/master' (early part)
Diffstat (limited to 'findutils')
-rw-r--r--findutils/.gitignore3
-rw-r--r--findutils/Config.in253
-rw-r--r--findutils/Config.src10
-rw-r--r--findutils/Kbuild.src (renamed from findutils/Kbuild)5
-rw-r--r--findutils/find.c184
-rw-r--r--findutils/grep.c47
-rw-r--r--findutils/xargs.c41
7 files changed, 280 insertions, 263 deletions
diff --git a/findutils/.gitignore b/findutils/.gitignore
new file mode 100644
index 000000000..7a30caf5c
--- /dev/null
+++ b/findutils/.gitignore
@@ -0,0 +1,3 @@
1# Config.in and Kbuild are auto-generated
2Config.in
3Kbuild
diff --git a/findutils/Config.in b/findutils/Config.in
deleted file mode 100644
index 8582d6446..000000000
--- a/findutils/Config.in
+++ /dev/null
@@ -1,253 +0,0 @@
1#
2# For a description of the syntax of this configuration file,
3# see scripts/kbuild/config-language.txt.
4#
5
6menu "Finding Utilities"
7
8config FIND
9 bool "find"
10 default n
11 help
12 find is used to search your system to find specified files.
13
14config FEATURE_FIND_PRINT0
15 bool "Enable -print0: NUL-terminated output"
16 default y
17 depends on FIND
18 help
19 Causes output names to be separated by a NUL character
20 rather than a newline. This allows names that contain
21 newlines and other whitespace to be more easily
22 interpreted by other programs.
23
24config FEATURE_FIND_MTIME
25 bool "Enable -mtime: modified time matching"
26 default y
27 depends on FIND
28 help
29 Allow searching based on the modification time of
30 files, in days.
31
32config FEATURE_FIND_MMIN
33 bool "Enable -mmin: modified time matching by minutes"
34 default y
35 depends on FIND
36 help
37 Allow searching based on the modification time of
38 files, in minutes.
39
40config FEATURE_FIND_PERM
41 bool "Enable -perm: permissions matching"
42 default y
43 depends on FIND
44 help
45 Enable searching based on file permissions.
46
47config FEATURE_FIND_TYPE
48 bool "Enable -type: file type matching (file/dir/link/...)"
49 default y
50 depends on FIND
51 help
52 Enable searching based on file type (file,
53 directory, socket, device, etc.).
54
55config FEATURE_FIND_XDEV
56 bool "Enable -xdev: 'stay in filesystem'"
57 default y
58 depends on FIND
59 help
60 This option allows find to restrict searches to a single filesystem.
61
62config FEATURE_FIND_MAXDEPTH
63 bool "Enable -maxdepth N"
64 default y
65 depends on FIND
66 help
67 This option enables -maxdepth N option.
68
69config FEATURE_FIND_NEWER
70 bool "Enable -newer: compare file modification times"
71 default y
72 depends on FIND
73 help
74 Support the 'find -newer' option for finding any files which have
75 a modified time that is more recent than the specified FILE.
76
77config FEATURE_FIND_INUM
78 bool "Enable -inum: inode number matching"
79 default y
80 depends on FIND
81 help
82 Support the 'find -inum' option for searching by inode number.
83
84config FEATURE_FIND_EXEC
85 bool "Enable -exec: execute commands"
86 default y
87 depends on FIND
88 help
89 Support the 'find -exec' option for executing commands based upon
90 the files matched.
91
92config FEATURE_FIND_USER
93 bool "Enable -user: username/uid matching"
94 default y
95 depends on FIND
96 help
97 Support the 'find -user' option for searching by username or uid.
98
99config FEATURE_FIND_GROUP
100 bool "Enable -group: group/gid matching"
101 default y
102 depends on FIND
103 help
104 Support the 'find -group' option for searching by group name or gid.
105
106config FEATURE_FIND_NOT
107 bool "Enable the 'not' (!) operator"
108 default y
109 depends on FIND
110 help
111 Support the '!' operator to invert the test results.
112 If 'Enable full-blown desktop' is enabled, then will also support
113 the non-POSIX notation '-not'.
114
115config FEATURE_FIND_DEPTH
116 bool "Enable -depth"
117 default y
118 depends on FIND
119 help
120 Process each directory's contents before the directory itself.
121
122config FEATURE_FIND_PAREN
123 bool "Enable parens in options"
124 default y
125 depends on FIND
126 help
127 Enable usage of parens '(' to specify logical order of arguments.
128
129config FEATURE_FIND_SIZE
130 bool "Enable -size: file size matching"
131 default y
132 depends on FIND
133 help
134 Support the 'find -size' option for searching by file size.
135
136config FEATURE_FIND_PRUNE
137 bool "Enable -prune: exclude subdirectories"
138 default y
139 depends on FIND
140 help
141 If the file is a directory, dont descend into it. Useful for
142 exclusion .svn and CVS directories.
143
144config FEATURE_FIND_DELETE
145 bool "Enable -delete: delete files/dirs"
146 default n
147 depends on FIND && FEATURE_FIND_DEPTH
148 help
149 Support the 'find -delete' option for deleting files and directories.
150 WARNING: This option can do much harm if used wrong. Busybox will not
151 try to protect the user from doing stupid things. Use with care.
152
153config FEATURE_FIND_PATH
154 bool "Enable -path: match pathname with shell pattern"
155 default y
156 depends on FIND
157 help
158 The -path option matches whole pathname instead of just filename.
159
160config FEATURE_FIND_REGEX
161 bool "Enable -regex: match pathname with regex"
162 default y
163 depends on FIND
164 help
165 The -regex option matches whole pathname against regular expression.
166
167config FEATURE_FIND_CONTEXT
168 bool "Enable -context: security context matching"
169 default n
170 depends on FIND && SELINUX
171 help
172 Support the 'find -context' option for matching security context.
173
174config FEATURE_FIND_LINKS
175 bool "Enable -links: link count matching"
176 default n
177 depends on FIND
178 help
179 Support the 'find -links' option for matching number of links.
180
181config GREP
182 bool "grep"
183 default n
184 help
185 grep is used to search files for a specified pattern.
186
187config FEATURE_GREP_EGREP_ALIAS
188 bool "Enable extended regular expressions (egrep & grep -E)"
189 default y
190 depends on GREP
191 help
192 Enabled support for extended regular expressions. Extended
193 regular expressions allow for alternation (foo|bar), grouping,
194 and various repetition operators.
195
196config FEATURE_GREP_FGREP_ALIAS
197 bool "Alias fgrep to grep -F"
198 default y
199 depends on GREP
200 help
201 fgrep sees the search pattern as a normal string rather than
202 regular expressions.
203 grep -F always works, this just creates the fgrep alias.
204
205config FEATURE_GREP_CONTEXT
206 bool "Enable before and after context flags (-A, -B and -C)"
207 default y
208 depends on GREP
209 help
210 Print the specified number of leading (-B) and/or trailing (-A)
211 context surrounding our matching lines.
212 Print the specified number of context lines (-C).
213
214config XARGS
215 bool "xargs"
216 default n
217 help
218 xargs is used to execute a specified command for
219 every item from standard input.
220
221config FEATURE_XARGS_SUPPORT_CONFIRMATION
222 bool "Enable -p: prompt and confirmation"
223 default n
224 depends on XARGS
225 help
226 Support -p: prompt the user whether to run each command
227 line and read a line from the terminal.
228
229config FEATURE_XARGS_SUPPORT_QUOTES
230 bool "Enable single and double quotes and backslash"
231 default n
232 depends on XARGS
233 help
234 Support quoting in the input.
235
236config FEATURE_XARGS_SUPPORT_TERMOPT
237 bool "Enable -x: exit if -s or -n is exceeded"
238 default n
239 depends on XARGS
240 help
241 Support -x: exit if the command size (see the -s or -n option)
242 is exceeded.
243
244config FEATURE_XARGS_SUPPORT_ZERO_TERM
245 bool "Enable -0: NUL-terminated input"
246 default n
247 depends on XARGS
248 help
249 Support -0: input items are terminated by a NUL character
250 instead of whitespace, and the quotes and backslash
251 are not special.
252
253endmenu
diff --git a/findutils/Config.src b/findutils/Config.src
new file mode 100644
index 000000000..9ee71a845
--- /dev/null
+++ b/findutils/Config.src
@@ -0,0 +1,10 @@
1#
2# For a description of the syntax of this configuration file,
3# see scripts/kbuild/config-language.txt.
4#
5
6menu "Finding Utilities"
7
8INSERT
9
10endmenu
diff --git a/findutils/Kbuild b/findutils/Kbuild.src
index 7b504bacf..771789ff5 100644
--- a/findutils/Kbuild
+++ b/findutils/Kbuild.src
@@ -5,6 +5,5 @@
5# Licensed under the GPL v2, see the file LICENSE in this tarball. 5# Licensed under the GPL v2, see the file LICENSE in this tarball.
6 6
7lib-y:= 7lib-y:=
8lib-$(CONFIG_FIND) += find.o 8
9lib-$(CONFIG_GREP) += grep.o 9INSERT
10lib-$(CONFIG_XARGS) += xargs.o
diff --git a/findutils/find.c b/findutils/find.c
index 0b06938da..9022867a2 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -53,6 +53,181 @@
53 * diff -u /tmp/std_find /tmp/bb_find && echo Identical 53 * diff -u /tmp/std_find /tmp/bb_find && echo Identical
54 */ 54 */
55 55
56//kbuild:lib-$(CONFIG_FIND) += find.o
57//config:
58//config:config FIND
59//config: bool "find"
60//config: default n
61//config: help
62//config: find is used to search your system to find specified files.
63//config:
64//config:config FEATURE_FIND_PRINT0
65//config: bool "Enable -print0: NUL-terminated output"
66//config: default y
67//config: depends on FIND
68//config: help
69//config: Causes output names to be separated by a NUL character
70//config: rather than a newline. This allows names that contain
71//config: newlines and other whitespace to be more easily
72//config: interpreted by other programs.
73//config:
74//config:config FEATURE_FIND_MTIME
75//config: bool "Enable -mtime: modified time matching"
76//config: default y
77//config: depends on FIND
78//config: help
79//config: Allow searching based on the modification time of
80//config: files, in days.
81//config:
82//config:config FEATURE_FIND_MMIN
83//config: bool "Enable -mmin: modified time matching by minutes"
84//config: default y
85//config: depends on FIND
86//config: help
87//config: Allow searching based on the modification time of
88//config: files, in minutes.
89//config:
90//config:config FEATURE_FIND_PERM
91//config: bool "Enable -perm: permissions matching"
92//config: default y
93//config: depends on FIND
94//config: help
95//config: Enable searching based on file permissions.
96//config:
97//config:config FEATURE_FIND_TYPE
98//config: bool "Enable -type: file type matching (file/dir/link/...)"
99//config: default y
100//config: depends on FIND
101//config: help
102//config: Enable searching based on file type (file,
103//config: directory, socket, device, etc.).
104//config:
105//config:config FEATURE_FIND_XDEV
106//config: bool "Enable -xdev: 'stay in filesystem'"
107//config: default y
108//config: depends on FIND
109//config: help
110//config: This option allows find to restrict searches to a single filesystem.
111//config:
112//config:config FEATURE_FIND_MAXDEPTH
113//config: bool "Enable -maxdepth N"
114//config: default y
115//config: depends on FIND
116//config: help
117//config: This option enables -maxdepth N option.
118//config:
119//config:config FEATURE_FIND_NEWER
120//config: bool "Enable -newer: compare file modification times"
121//config: default y
122//config: depends on FIND
123//config: help
124//config: Support the 'find -newer' option for finding any files which have
125//config: a modified time that is more recent than the specified FILE.
126//config:
127//config:config FEATURE_FIND_INUM
128//config: bool "Enable -inum: inode number matching"
129//config: default y
130//config: depends on FIND
131//config: help
132//config: Support the 'find -inum' option for searching by inode number.
133//config:
134//config:config FEATURE_FIND_EXEC
135//config: bool "Enable -exec: execute commands"
136//config: default y
137//config: depends on FIND
138//config: help
139//config: Support the 'find -exec' option for executing commands based upon
140//config: the files matched.
141//config:
142//config:config FEATURE_FIND_USER
143//config: bool "Enable -user: username/uid matching"
144//config: default y
145//config: depends on FIND
146//config: help
147//config: Support the 'find -user' option for searching by username or uid.
148//config:
149//config:config FEATURE_FIND_GROUP
150//config: bool "Enable -group: group/gid matching"
151//config: default y
152//config: depends on FIND
153//config: help
154//config: Support the 'find -group' option for searching by group name or gid.
155//config:
156//config:config FEATURE_FIND_NOT
157//config: bool "Enable the 'not' (!) operator"
158//config: default y
159//config: depends on FIND
160//config: help
161//config: Support the '!' operator to invert the test results.
162//config: If 'Enable full-blown desktop' is enabled, then will also support
163//config: the non-POSIX notation '-not'.
164//config:
165//config:config FEATURE_FIND_DEPTH
166//config: bool "Enable -depth"
167//config: default y
168//config: depends on FIND
169//config: help
170//config: Process each directory's contents before the directory itself.
171//config:
172//config:config FEATURE_FIND_PAREN
173//config: bool "Enable parens in options"
174//config: default y
175//config: depends on FIND
176//config: help
177//config: Enable usage of parens '(' to specify logical order of arguments.
178//config:
179//config:config FEATURE_FIND_SIZE
180//config: bool "Enable -size: file size matching"
181//config: default y
182//config: depends on FIND
183//config: help
184//config: Support the 'find -size' option for searching by file size.
185//config:
186//config:config FEATURE_FIND_PRUNE
187//config: bool "Enable -prune: exclude subdirectories"
188//config: default y
189//config: depends on FIND
190//config: help
191//config: If the file is a directory, dont descend into it. Useful for
192//config: exclusion .svn and CVS directories.
193//config:
194//config:config FEATURE_FIND_DELETE
195//config: bool "Enable -delete: delete files/dirs"
196//config: default n
197//config: depends on FIND && FEATURE_FIND_DEPTH
198//config: help
199//config: Support the 'find -delete' option for deleting files and directories.
200//config: WARNING: This option can do much harm if used wrong. Busybox will not
201//config: try to protect the user from doing stupid things. Use with care.
202//config:
203//config:config FEATURE_FIND_PATH
204//config: bool "Enable -path: match pathname with shell pattern"
205//config: default y
206//config: depends on FIND
207//config: help
208//config: The -path option matches whole pathname instead of just filename.
209//config:
210//config:config FEATURE_FIND_REGEX
211//config: bool "Enable -regex: match pathname with regex"
212//config: default y
213//config: depends on FIND
214//config: help
215//config: The -regex option matches whole pathname against regular expression.
216//config:
217//config:config FEATURE_FIND_CONTEXT
218//config: bool "Enable -context: security context matching"
219//config: default n
220//config: depends on FIND && SELINUX
221//config: help
222//config: Support the 'find -context' option for matching security context.
223//config:
224//config:config FEATURE_FIND_LINKS
225//config: bool "Enable -links: link count matching"
226//config: default n
227//config: depends on FIND
228//config: help
229//config: Support the 'find -links' option for matching number of links.
230
56#include <fnmatch.h> 231#include <fnmatch.h>
57#include "libbb.h" 232#include "libbb.h"
58#if ENABLE_FEATURE_FIND_REGEX 233#if ENABLE_FEATURE_FIND_REGEX
@@ -198,14 +373,19 @@ static int exec_actions(action ***appp, const char *fileName, const struct stat
198ACTF(name) 373ACTF(name)
199{ 374{
200 const char *tmp = bb_basename(fileName); 375 const char *tmp = bb_basename(fileName);
201 if (tmp != fileName && !*tmp) { /* "foo/bar/". Oh no... go back to 'b' */ 376 if (tmp != fileName && *tmp == '\0') {
377 /* "foo/bar/". Oh no... go back to 'b' */
202 tmp--; 378 tmp--;
203 while (tmp != fileName && *--tmp != '/') 379 while (tmp != fileName && *--tmp != '/')
204 continue; 380 continue;
205 if (*tmp == '/') 381 if (*tmp == '/')
206 tmp++; 382 tmp++;
207 } 383 }
208 return fnmatch(ap->pattern, tmp, FNM_PERIOD | (ap->iname ? FNM_CASEFOLD : 0)) == 0; 384 /* Was using FNM_PERIOD flag too,
385 * but somewhere between 4.1.20 and 4.4.0 GNU find stopped using it.
386 * find -name '*foo' should match .foo too:
387 */
388 return fnmatch(ap->pattern, tmp, (ap->iname ? FNM_CASEFOLD : 0)) == 0;
209} 389}
210 390
211#if ENABLE_FEATURE_FIND_PATH 391#if ENABLE_FEATURE_FIND_PATH
diff --git a/findutils/grep.c b/findutils/grep.c
index 318fb4b2f..d5fe10320 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -19,15 +19,49 @@
19 * (C) 2006 Jac Goudsmit added -o option 19 * (C) 2006 Jac Goudsmit added -o option
20 */ 20 */
21 21
22//kbuild:lib-$(CONFIG_GREP) += grep.o
23//config:
24//config:config GREP
25//config: bool "grep"
26//config: default n
27//config: help
28//config: grep is used to search files for a specified pattern.
29//config:
30//config:config FEATURE_GREP_EGREP_ALIAS
31//config: bool "Enable extended regular expressions (egrep & grep -E)"
32//config: default y
33//config: depends on GREP
34//config: help
35//config: Enabled support for extended regular expressions. Extended
36//config: regular expressions allow for alternation (foo|bar), grouping,
37//config: and various repetition operators.
38//config:
39//config:config FEATURE_GREP_FGREP_ALIAS
40//config: bool "Alias fgrep to grep -F"
41//config: default y
42//config: depends on GREP
43//config: help
44//config: fgrep sees the search pattern as a normal string rather than
45//config: regular expressions.
46//config: grep -F always works, this just creates the fgrep alias.
47//config:
48//config:config FEATURE_GREP_CONTEXT
49//config: bool "Enable before and after context flags (-A, -B and -C)"
50//config: default y
51//config: depends on GREP
52//config: help
53//config: Print the specified number of leading (-B) and/or trailing (-A)
54//config: context surrounding our matching lines.
55//config: Print the specified number of context lines (-C).
56
22#include "libbb.h" 57#include "libbb.h"
23#include "xregex.h" 58#include "xregex.h"
24 59
25/* options */ 60/* options */
26#define OPTSTR_GREP \ 61#define OPTSTR_GREP \
27 "lnqvscFiHhe:f:Lorm:" \ 62 "lnqvscFiHhe:f:Lorm:w" \
28 IF_FEATURE_GREP_CONTEXT("A:B:C:") \ 63 IF_FEATURE_GREP_CONTEXT("A:B:C:") \
29 IF_FEATURE_GREP_EGREP_ALIAS("E") \ 64 IF_FEATURE_GREP_EGREP_ALIAS("E") \
30 IF_DESKTOP("w") \
31 IF_EXTRA_COMPAT("z") \ 65 IF_EXTRA_COMPAT("z") \
32 "aI" 66 "aI"
33 67
@@ -51,11 +85,11 @@ enum {
51 OPTBIT_o, /* show only matching parts of lines */ 85 OPTBIT_o, /* show only matching parts of lines */
52 OPTBIT_r, /* recurse dirs */ 86 OPTBIT_r, /* recurse dirs */
53 OPTBIT_m, /* -m MAX_MATCHES */ 87 OPTBIT_m, /* -m MAX_MATCHES */
88 OPTBIT_w, /* -w whole word match */
54 IF_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */ 89 IF_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */
55 IF_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */ 90 IF_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */
56 IF_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */ 91 IF_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */
57 IF_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */ 92 IF_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */
58 IF_DESKTOP( OPTBIT_w ,) /* whole word match */
59 IF_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */ 93 IF_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */
60 OPT_l = 1 << OPTBIT_l, 94 OPT_l = 1 << OPTBIT_l,
61 OPT_n = 1 << OPTBIT_n, 95 OPT_n = 1 << OPTBIT_n,
@@ -73,11 +107,11 @@ enum {
73 OPT_o = 1 << OPTBIT_o, 107 OPT_o = 1 << OPTBIT_o,
74 OPT_r = 1 << OPTBIT_r, 108 OPT_r = 1 << OPTBIT_r,
75 OPT_m = 1 << OPTBIT_m, 109 OPT_m = 1 << OPTBIT_m,
110 OPT_w = 1 << OPTBIT_w,
76 OPT_A = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0, 111 OPT_A = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0,
77 OPT_B = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0, 112 OPT_B = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0,
78 OPT_C = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0, 113 OPT_C = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0,
79 OPT_E = IF_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0, 114 OPT_E = IF_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0,
80 OPT_w = IF_DESKTOP( (1 << OPTBIT_w)) + 0,
81 OPT_z = IF_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0, 115 OPT_z = IF_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0,
82}; 116};
83 117
@@ -263,7 +297,10 @@ static int grep_file(FILE *file)
263 while (pattern_ptr) { 297 while (pattern_ptr) {
264 gl = (grep_list_data_t *)pattern_ptr->data; 298 gl = (grep_list_data_t *)pattern_ptr->data;
265 if (FGREP_FLAG) { 299 if (FGREP_FLAG) {
266 found |= (strstr(line, gl->pattern) != NULL); 300 found |= (((option_mask32 & OPT_i)
301 ? strcasestr(line, gl->pattern)
302 : strstr(line, gl->pattern)
303 ) != NULL);
267 } else { 304 } else {
268 if (!(gl->flg_mem_alocated_compiled & COMPILED)) { 305 if (!(gl->flg_mem_alocated_compiled & COMPILED)) {
269 gl->flg_mem_alocated_compiled |= COMPILED; 306 gl->flg_mem_alocated_compiled |= COMPILED;
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 3785f1ec0..c55ac5724 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -17,6 +17,47 @@
17 * 17 *
18 */ 18 */
19 19
20//kbuild:lib-$(CONFIG_XARGS) += xargs.o
21//config:
22//config:config XARGS
23//config: bool "xargs"
24//config: default n
25//config: help
26//config: xargs is used to execute a specified command for
27//config: every item from standard input.
28//config:
29//config:config FEATURE_XARGS_SUPPORT_CONFIRMATION
30//config: bool "Enable -p: prompt and confirmation"
31//config: default n
32//config: depends on XARGS
33//config: help
34//config: Support -p: prompt the user whether to run each command
35//config: line and read a line from the terminal.
36//config:
37//config:config FEATURE_XARGS_SUPPORT_QUOTES
38//config: bool "Enable single and double quotes and backslash"
39//config: default n
40//config: depends on XARGS
41//config: help
42//config: Support quoting in the input.
43//config:
44//config:config FEATURE_XARGS_SUPPORT_TERMOPT
45//config: bool "Enable -x: exit if -s or -n is exceeded"
46//config: default n
47//config: depends on XARGS
48//config: help
49//config: Support -x: exit if the command size (see the -s or -n option)
50//config: is exceeded.
51//config:
52//config:config FEATURE_XARGS_SUPPORT_ZERO_TERM
53//config: bool "Enable -0: NUL-terminated input"
54//config: default n
55//config: depends on XARGS
56//config: help
57//config: Support -0: input items are terminated by a NUL character
58//config: instead of whitespace, and the quotes and backslash
59//config: are not special.
60
20#include "libbb.h" 61#include "libbb.h"
21 62
22/* This is a NOEXEC applet. Be very careful! */ 63/* This is a NOEXEC applet. Be very careful! */