diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-09 04:22:48 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-09 04:22:48 +0200 |
commit | 7fb68f199f037cb69363c8df5c934a27adc699f7 (patch) | |
tree | 2eb01a3bc4b3caf6bd7dd4fed6984716fd7ca89a | |
parent | 6774386d95cec54258f23f69bc287c99e205ebdf (diff) | |
download | busybox-w32-7fb68f199f037cb69363c8df5c934a27adc699f7.tar.gz busybox-w32-7fb68f199f037cb69363c8df5c934a27adc699f7.tar.bz2 busybox-w32-7fb68f199f037cb69363c8df5c934a27adc699f7.zip |
make it possible to keep Config/Kbuild snippets in *.c files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | findutils/Config.in | 253 | ||||
-rw-r--r-- | findutils/Config.src | 10 | ||||
-rw-r--r-- | findutils/Kbuild.src (renamed from findutils/Kbuild) | 5 | ||||
-rw-r--r-- | findutils/find.c | 175 | ||||
-rw-r--r-- | findutils/grep.c | 35 | ||||
-rw-r--r-- | findutils/xargs.c | 41 | ||||
-rw-r--r-- | scripts/gen_build_files.sh | 55 |
8 files changed, 325 insertions, 258 deletions
@@ -377,6 +377,11 @@ ifneq ($(KBUILD_SRC),) | |||
377 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) | 377 | $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL) |
378 | endif | 378 | endif |
379 | 379 | ||
380 | # This target generates Kbuild's and Config.in's from *.c files | ||
381 | PHONY += gen_build_files | ||
382 | gen_build_files: | ||
383 | $(Q)$(srctree)/scripts/gen_build_files.sh $(srctree) $(objtree) | ||
384 | |||
380 | # To make sure we do not include .config for any of the *config targets | 385 | # To make sure we do not include .config for any of the *config targets |
381 | # catch them early, and hand them over to scripts/kconfig/Makefile | 386 | # catch them early, and hand them over to scripts/kconfig/Makefile |
382 | # It is allowed to specify more targets when calling make, including | 387 | # It is allowed to specify more targets when calling make, including |
@@ -428,7 +433,7 @@ ifeq ($(config-targets),1) | |||
428 | -include $(srctree)/arch/$(ARCH)/Makefile | 433 | -include $(srctree)/arch/$(ARCH)/Makefile |
429 | export KBUILD_DEFCONFIG | 434 | export KBUILD_DEFCONFIG |
430 | 435 | ||
431 | config %config: scripts_basic outputmakefile FORCE | 436 | config %config: scripts_basic outputmakefile gen_build_files FORCE |
432 | $(Q)mkdir -p include | 437 | $(Q)mkdir -p include |
433 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 438 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
434 | $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease | 439 | $(Q)$(MAKE) -C $(srctree) KBUILD_SRC= .kernelrelease |
@@ -443,7 +448,7 @@ ifeq ($(KBUILD_EXTMOD),) | |||
443 | # Carefully list dependencies so we do not try to build scripts twice | 448 | # Carefully list dependencies so we do not try to build scripts twice |
444 | # in parrallel | 449 | # in parrallel |
445 | PHONY += scripts | 450 | PHONY += scripts |
446 | scripts: scripts_basic include/config/MARKER | 451 | scripts: gen_build_files scripts_basic include/config/MARKER |
447 | $(Q)$(MAKE) $(build)=$(@) | 452 | $(Q)$(MAKE) $(build)=$(@) |
448 | 453 | ||
449 | scripts_basic: include/autoconf.h | 454 | scripts_basic: include/autoconf.h |
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 | |||
6 | menu "Finding Utilities" | ||
7 | |||
8 | config FIND | ||
9 | bool "find" | ||
10 | default n | ||
11 | help | ||
12 | find is used to search your system to find specified files. | ||
13 | |||
14 | config 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 | |||
24 | config 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 | |||
32 | config 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 | |||
40 | config 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 | |||
47 | config 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 | |||
55 | config 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 | |||
62 | config 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 | |||
69 | config 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 | |||
77 | config 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 | |||
84 | config 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 | |||
92 | config 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 | |||
99 | config 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 | |||
106 | config 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 | |||
115 | config 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 | |||
122 | config 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 | |||
129 | config 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 | |||
136 | config 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 | |||
144 | config 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 | |||
153 | config 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 | |||
160 | config 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 | |||
167 | config 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 | |||
174 | config 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 | |||
181 | config GREP | ||
182 | bool "grep" | ||
183 | default n | ||
184 | help | ||
185 | grep is used to search files for a specified pattern. | ||
186 | |||
187 | config 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 | |||
196 | config 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 | |||
205 | config 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 | |||
214 | config 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 | |||
221 | config 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 | |||
229 | config 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 | |||
236 | config 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 | |||
244 | config 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 | |||
253 | endmenu | ||
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 | |||
6 | menu "Finding Utilities" | ||
7 | |||
8 | INSERT | ||
9 | |||
10 | endmenu | ||
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 | ||
7 | lib-y:= | 7 | lib-y:= |
8 | lib-$(CONFIG_FIND) += find.o | 8 | |
9 | lib-$(CONFIG_GREP) += grep.o | 9 | INSERT |
10 | lib-$(CONFIG_XARGS) += xargs.o | ||
diff --git a/findutils/find.c b/findutils/find.c index 30fb03dd1..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 |
diff --git a/findutils/grep.c b/findutils/grep.c index 0f1c11abb..be290118f 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -19,6 +19,41 @@ | |||
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 | ||
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! */ |
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh new file mode 100644 index 000000000..300d90c2a --- /dev/null +++ b/scripts/gen_build_files.sh | |||
@@ -0,0 +1,55 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | test $# -ge 2 || exit 1 | ||
4 | |||
5 | # cd to objtree | ||
6 | cd "$2" || exit 1 | ||
7 | |||
8 | srctree="$1" | ||
9 | |||
10 | find -type d \ | ||
11 | | while read; do | ||
12 | d="$REPLY" | ||
13 | |||
14 | src="$srctree/$d/Kbuild.src" | ||
15 | dst="$d/Kbuild" | ||
16 | if test -f "$src"; then | ||
17 | echo " CHK $dst" | ||
18 | |||
19 | s=`grep -h '^//kbuild:' "$srctree/$d"/*.c | sed 's^//kbuild:^^'` | ||
20 | while read; do | ||
21 | test x"$REPLY" = x"INSERT" && REPLY="$s" | ||
22 | printf "%s\n" "$REPLY" | ||
23 | done <"$src" >"$dst.$$.tmp" | ||
24 | |||
25 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then | ||
26 | rm "$dst.$$.tmp" | ||
27 | else | ||
28 | echo " GEN $dst" | ||
29 | mv "$dst.$$.tmp" "$dst" | ||
30 | fi | ||
31 | fi | ||
32 | |||
33 | src="$srctree/$d/Config.src" | ||
34 | dst="$d/Config.in" | ||
35 | if test -f "$src"; then | ||
36 | echo " CHK $dst" | ||
37 | |||
38 | s=`grep -h '^//config:' "$srctree/$d"/*.c | sed 's^//config:^^'` | ||
39 | while read; do | ||
40 | test x"$REPLY" = x"INSERT" && REPLY="$s" | ||
41 | printf "%s\n" "$REPLY" | ||
42 | done <"$src" >"$dst.$$.tmp" | ||
43 | |||
44 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then | ||
45 | rm "$dst.$$.tmp" | ||
46 | else | ||
47 | echo " GEN $dst" | ||
48 | mv "$dst.$$.tmp" "$dst" | ||
49 | fi | ||
50 | fi | ||
51 | |||
52 | done | ||
53 | |||
54 | # Last read failed. This is normal. Don't exit with its error code: | ||
55 | exit 0 | ||