diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-12-22 15:21:58 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-12-22 15:21:58 +0100 |
commit | 6704746c697ace0cc0de5b231fc8be4db06c40f4 (patch) | |
tree | e1c684030876310ff9ff7e68d4615f59ec680625 | |
parent | 4acd393eba179f7dfe70f647e3798bc8d10c783a (diff) | |
download | busybox-w32-6704746c697ace0cc0de5b231fc8be4db06c40f4.tar.gz busybox-w32-6704746c697ace0cc0de5b231fc8be4db06c40f4.tar.bz2 busybox-w32-6704746c697ace0cc0de5b231fc8be4db06c40f4.zip |
shell: move "config" blocks above their use in coditional includes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 163 | ||||
-rw-r--r-- | shell/hush.c | 58 |
2 files changed, 110 insertions, 111 deletions
diff --git a/shell/ash.c b/shell/ash.c index 89339182e..b11f36589 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -15,88 +15,6 @@ | |||
15 | * | 15 | * |
16 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. | 16 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
17 | */ | 17 | */ |
18 | |||
19 | /* | ||
20 | * The following should be set to reflect the type of system you have: | ||
21 | * JOBS -> 1 if you have Berkeley job control, 0 otherwise. | ||
22 | * define SYSV if you are running under System V. | ||
23 | * define DEBUG=1 to compile in debugging ('set -o debug' to turn on) | ||
24 | * define DEBUG=2 to compile in and turn on debugging. | ||
25 | * | ||
26 | * When debugging is on (DEBUG is 1 and "set -o debug" was executed), | ||
27 | * debugging info will be written to ./trace and a quit signal | ||
28 | * will generate a core dump. | ||
29 | */ | ||
30 | #define DEBUG 0 | ||
31 | /* Tweak debug output verbosity here */ | ||
32 | #define DEBUG_TIME 0 | ||
33 | #define DEBUG_PID 1 | ||
34 | #define DEBUG_SIG 1 | ||
35 | #define DEBUG_INTONOFF 0 | ||
36 | |||
37 | #define PROFILE 0 | ||
38 | |||
39 | #define JOBS ENABLE_ASH_JOB_CONTROL | ||
40 | |||
41 | #include <setjmp.h> | ||
42 | #include <fnmatch.h> | ||
43 | #include <sys/times.h> | ||
44 | #include <sys/utsname.h> /* for setting $HOSTNAME */ | ||
45 | |||
46 | #include "busybox.h" /* for applet_names */ | ||
47 | |||
48 | #if defined(__ANDROID_API__) && __ANDROID_API__ <= 24 | ||
49 | /* Bionic at least up to version 24 has no glob() */ | ||
50 | # undef ENABLE_ASH_INTERNAL_GLOB | ||
51 | # define ENABLE_ASH_INTERNAL_GLOB 1 | ||
52 | #endif | ||
53 | |||
54 | #if !ENABLE_ASH_INTERNAL_GLOB && defined(__UCLIBC__) | ||
55 | # error uClibc glob() is buggy, use ASH_INTERNAL_GLOB. | ||
56 | # error The bug is: for "$PWD"/<pattern> ash will escape e.g. dashes in "$PWD" | ||
57 | # error with backslash, even ones which do not need to be: "/a-b" -> "/a\-b" | ||
58 | # error glob() should unbackslash them and match. uClibc does not unbackslash, | ||
59 | # error fails to match dirname, subsequently not expanding <pattern> in it. | ||
60 | // Testcase: | ||
61 | // if (glob("/etc/polkit\\-1", 0, NULL, &pglob)) - this returns 0 on uclibc, no bug | ||
62 | // if (glob("/etc/polkit\\-1/*", 0, NULL, &pglob)) printf("uclibc bug!\n"); | ||
63 | #endif | ||
64 | |||
65 | #if !ENABLE_ASH_INTERNAL_GLOB | ||
66 | # include <glob.h> | ||
67 | #endif | ||
68 | |||
69 | #include "unicode.h" | ||
70 | #include "shell_common.h" | ||
71 | #if ENABLE_SH_MATH_SUPPORT | ||
72 | # include "math.h" | ||
73 | #endif | ||
74 | #if ENABLE_ASH_RANDOM_SUPPORT | ||
75 | # include "random.h" | ||
76 | #else | ||
77 | # define CLEAR_RANDOM_T(rnd) ((void)0) | ||
78 | #endif | ||
79 | |||
80 | #include "NUM_APPLETS.h" | ||
81 | #if NUM_APPLETS == 1 | ||
82 | /* STANDALONE does not make sense, and won't compile */ | ||
83 | # undef CONFIG_FEATURE_SH_STANDALONE | ||
84 | # undef ENABLE_FEATURE_SH_STANDALONE | ||
85 | # undef IF_FEATURE_SH_STANDALONE | ||
86 | # undef IF_NOT_FEATURE_SH_STANDALONE | ||
87 | # define ENABLE_FEATURE_SH_STANDALONE 0 | ||
88 | # define IF_FEATURE_SH_STANDALONE(...) | ||
89 | # define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__ | ||
90 | #endif | ||
91 | |||
92 | #ifndef PIPE_BUF | ||
93 | # define PIPE_BUF 4096 /* amount of buffering in a pipe */ | ||
94 | #endif | ||
95 | |||
96 | #if !BB_MMU | ||
97 | # error "Do not even bother, ash will not run on NOMMU machine" | ||
98 | #endif | ||
99 | |||
100 | //config:config ASH | 18 | //config:config ASH |
101 | //config: bool "ash" | 19 | //config: bool "ash" |
102 | //config: default y | 20 | //config: default y |
@@ -230,6 +148,87 @@ | |||
230 | //kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o | 148 | //kbuild:lib-$(CONFIG_ASH) += ash.o ash_ptr_hack.o shell_common.o |
231 | //kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o | 149 | //kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o |
232 | 150 | ||
151 | /* | ||
152 | * The following should be set to reflect the type of system you have: | ||
153 | * JOBS -> 1 if you have Berkeley job control, 0 otherwise. | ||
154 | * define SYSV if you are running under System V. | ||
155 | * define DEBUG=1 to compile in debugging ('set -o debug' to turn on) | ||
156 | * define DEBUG=2 to compile in and turn on debugging. | ||
157 | * | ||
158 | * When debugging is on (DEBUG is 1 and "set -o debug" was executed), | ||
159 | * debugging info will be written to ./trace and a quit signal | ||
160 | * will generate a core dump. | ||
161 | */ | ||
162 | #define DEBUG 0 | ||
163 | /* Tweak debug output verbosity here */ | ||
164 | #define DEBUG_TIME 0 | ||
165 | #define DEBUG_PID 1 | ||
166 | #define DEBUG_SIG 1 | ||
167 | #define DEBUG_INTONOFF 0 | ||
168 | |||
169 | #define PROFILE 0 | ||
170 | |||
171 | #define JOBS ENABLE_ASH_JOB_CONTROL | ||
172 | |||
173 | #include <setjmp.h> | ||
174 | #include <fnmatch.h> | ||
175 | #include <sys/times.h> | ||
176 | #include <sys/utsname.h> /* for setting $HOSTNAME */ | ||
177 | |||
178 | #include "busybox.h" /* for applet_names */ | ||
179 | |||
180 | #if defined(__ANDROID_API__) && __ANDROID_API__ <= 24 | ||
181 | /* Bionic at least up to version 24 has no glob() */ | ||
182 | # undef ENABLE_ASH_INTERNAL_GLOB | ||
183 | # define ENABLE_ASH_INTERNAL_GLOB 1 | ||
184 | #endif | ||
185 | |||
186 | #if !ENABLE_ASH_INTERNAL_GLOB && defined(__UCLIBC__) | ||
187 | # error uClibc glob() is buggy, use ASH_INTERNAL_GLOB. | ||
188 | # error The bug is: for "$PWD"/<pattern> ash will escape e.g. dashes in "$PWD" | ||
189 | # error with backslash, even ones which do not need to be: "/a-b" -> "/a\-b" | ||
190 | # error glob() should unbackslash them and match. uClibc does not unbackslash, | ||
191 | # error fails to match dirname, subsequently not expanding <pattern> in it. | ||
192 | // Testcase: | ||
193 | // if (glob("/etc/polkit\\-1", 0, NULL, &pglob)) - this returns 0 on uclibc, no bug | ||
194 | // if (glob("/etc/polkit\\-1/*", 0, NULL, &pglob)) printf("uclibc bug!\n"); | ||
195 | #endif | ||
196 | |||
197 | #if !ENABLE_ASH_INTERNAL_GLOB | ||
198 | # include <glob.h> | ||
199 | #endif | ||
200 | |||
201 | #include "unicode.h" | ||
202 | #include "shell_common.h" | ||
203 | #if ENABLE_SH_MATH_SUPPORT | ||
204 | # include "math.h" | ||
205 | #endif | ||
206 | #if ENABLE_ASH_RANDOM_SUPPORT | ||
207 | # include "random.h" | ||
208 | #else | ||
209 | # define CLEAR_RANDOM_T(rnd) ((void)0) | ||
210 | #endif | ||
211 | |||
212 | #include "NUM_APPLETS.h" | ||
213 | #if NUM_APPLETS == 1 | ||
214 | /* STANDALONE does not make sense, and won't compile */ | ||
215 | # undef CONFIG_FEATURE_SH_STANDALONE | ||
216 | # undef ENABLE_FEATURE_SH_STANDALONE | ||
217 | # undef IF_FEATURE_SH_STANDALONE | ||
218 | # undef IF_NOT_FEATURE_SH_STANDALONE | ||
219 | # define ENABLE_FEATURE_SH_STANDALONE 0 | ||
220 | # define IF_FEATURE_SH_STANDALONE(...) | ||
221 | # define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__ | ||
222 | #endif | ||
223 | |||
224 | #ifndef PIPE_BUF | ||
225 | # define PIPE_BUF 4096 /* amount of buffering in a pipe */ | ||
226 | #endif | ||
227 | |||
228 | #if !BB_MMU | ||
229 | # error "Do not even bother, ash will not run on NOMMU machine" | ||
230 | #endif | ||
231 | |||
233 | 232 | ||
234 | /* ============ Hash table sizes. Configurable. */ | 233 | /* ============ Hash table sizes. Configurable. */ |
235 | 234 | ||
diff --git a/shell/hush.c b/shell/hush.c index 888be6e6e..c5821259a 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -82,35 +82,6 @@ | |||
82 | * $ "export" i=`echo 'aaa bbb'`; echo "$i" | 82 | * $ "export" i=`echo 'aaa bbb'`; echo "$i" |
83 | * aaa | 83 | * aaa |
84 | */ | 84 | */ |
85 | #if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \ | ||
86 | || defined(__APPLE__) \ | ||
87 | ) | ||
88 | # include <malloc.h> /* for malloc_trim */ | ||
89 | #endif | ||
90 | #include <glob.h> | ||
91 | /* #include <dmalloc.h> */ | ||
92 | #if ENABLE_HUSH_CASE | ||
93 | # include <fnmatch.h> | ||
94 | #endif | ||
95 | #include <sys/utsname.h> /* for setting $HOSTNAME */ | ||
96 | |||
97 | #include "busybox.h" /* for APPLET_IS_NOFORK/NOEXEC */ | ||
98 | #include "unicode.h" | ||
99 | #include "shell_common.h" | ||
100 | #include "math.h" | ||
101 | #include "match.h" | ||
102 | #if ENABLE_HUSH_RANDOM_SUPPORT | ||
103 | # include "random.h" | ||
104 | #else | ||
105 | # define CLEAR_RANDOM_T(rnd) ((void)0) | ||
106 | #endif | ||
107 | #ifndef F_DUPFD_CLOEXEC | ||
108 | # define F_DUPFD_CLOEXEC F_DUPFD | ||
109 | #endif | ||
110 | #ifndef PIPE_BUF | ||
111 | # define PIPE_BUF 4096 /* amount of buffering in a pipe */ | ||
112 | #endif | ||
113 | |||
114 | //config:config HUSH | 85 | //config:config HUSH |
115 | //config: bool "hush" | 86 | //config: bool "hush" |
116 | //config: default y | 87 | //config: default y |
@@ -277,6 +248,35 @@ | |||
277 | //usage:# define bash_full_usage hush_full_usage | 248 | //usage:# define bash_full_usage hush_full_usage |
278 | //usage:#endif | 249 | //usage:#endif |
279 | 250 | ||
251 | #if !(defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) \ | ||
252 | || defined(__APPLE__) \ | ||
253 | ) | ||
254 | # include <malloc.h> /* for malloc_trim */ | ||
255 | #endif | ||
256 | #include <glob.h> | ||
257 | /* #include <dmalloc.h> */ | ||
258 | #if ENABLE_HUSH_CASE | ||
259 | # include <fnmatch.h> | ||
260 | #endif | ||
261 | #include <sys/utsname.h> /* for setting $HOSTNAME */ | ||
262 | |||
263 | #include "busybox.h" /* for APPLET_IS_NOFORK/NOEXEC */ | ||
264 | #include "unicode.h" | ||
265 | #include "shell_common.h" | ||
266 | #include "math.h" | ||
267 | #include "match.h" | ||
268 | #if ENABLE_HUSH_RANDOM_SUPPORT | ||
269 | # include "random.h" | ||
270 | #else | ||
271 | # define CLEAR_RANDOM_T(rnd) ((void)0) | ||
272 | #endif | ||
273 | #ifndef F_DUPFD_CLOEXEC | ||
274 | # define F_DUPFD_CLOEXEC F_DUPFD | ||
275 | #endif | ||
276 | #ifndef PIPE_BUF | ||
277 | # define PIPE_BUF 4096 /* amount of buffering in a pipe */ | ||
278 | #endif | ||
279 | |||
280 | 280 | ||
281 | /* Build knobs */ | 281 | /* Build knobs */ |
282 | #define LEAK_HUNTING 0 | 282 | #define LEAK_HUNTING 0 |