1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
diff -urpN busybox-1.16.0/applets/applet_tables.c busybox-1.16.0-standalone_single/applets/applet_tables.c
--- busybox-1.16.0/applets/applet_tables.c 2010-01-25 01:59:38.000000000 +0100
+++ busybox-1.16.0-standalone_single/applets/applet_tables.c 2010-03-21 19:44:06.000000000 +0100
@@ -79,6 +79,7 @@ int main(int argc, char **argv)
}
printf("\n");
+ printf("#ifndef SKIP_definitions\n");
printf("const char applet_names[] ALIGN1 = \"\"\n");
for (i = 0; i < NUM_APPLETS; i++) {
printf("\"%s\" \"\\0\"\n", applets[i].name);
@@ -120,9 +121,10 @@ int main(int argc, char **argv)
printf("0x%02x,\n", v);
i++;
}
- printf("};\n\n");
+ printf("};\n");
#endif
-
+ printf("#endif /* SKIP_definitions */\n");
+ printf("\n");
printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN);
return 0;
diff -urpN busybox-1.16.0/shell/ash.c busybox-1.16.0-standalone_single/shell/ash.c
--- busybox-1.16.0/shell/ash.c 2010-01-25 01:59:38.000000000 +0100
+++ busybox-1.16.0-standalone_single/shell/ash.c 2010-03-21 19:44:06.000000000 +0100
@@ -43,8 +43,6 @@
#endif
#include "busybox.h" /* for applet_names */
-//TODO: pull in some .h and find out do we have SINGLE_APPLET_MAIN?
-//#include "applet_tables.h" doesn't work
#include <paths.h>
#include <setjmp.h>
#include <fnmatch.h>
@@ -58,12 +56,15 @@
# define CLEAR_RANDOM_T(rnd) ((void)0)
#endif
-#if defined SINGLE_APPLET_MAIN
+#define SKIP_definitions 1
+#include "applet_tables.h"
+#undef SKIP_definitions
+#if NUM_APPLETS == 1
/* STANDALONE does not make sense, and won't compile */
# undef CONFIG_FEATURE_SH_STANDALONE
# undef ENABLE_FEATURE_SH_STANDALONE
# undef IF_FEATURE_SH_STANDALONE
-# undef IF_NOT_FEATURE_SH_STANDALONE(...)
+# undef IF_NOT_FEATURE_SH_STANDALONE
# define ENABLE_FEATURE_SH_STANDALONE 0
# define IF_FEATURE_SH_STANDALONE(...)
# define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__
diff -urpN busybox-1.16.0/shell/hush.c busybox-1.16.0-standalone_single/shell/hush.c
--- busybox-1.16.0/shell/hush.c 2010-01-25 17:51:24.000000000 +0100
+++ busybox-1.16.0-standalone_single/shell/hush.c 2010-03-21 19:44:06.000000000 +0100
@@ -125,14 +125,18 @@
# define USE_FOR_MMU(...)
#endif
-#if defined SINGLE_APPLET_MAIN
+#define SKIP_definitions 1
+#include "applet_tables.h"
+#undef SKIP_definitions
+#if NUM_APPLETS == 1
/* STANDALONE does not make sense, and won't compile */
# undef CONFIG_FEATURE_SH_STANDALONE
# undef ENABLE_FEATURE_SH_STANDALONE
# undef IF_FEATURE_SH_STANDALONE
+# undef IF_NOT_FEATURE_SH_STANDALONE
+# define ENABLE_FEATURE_SH_STANDALONE 0
# define IF_FEATURE_SH_STANDALONE(...)
# define IF_NOT_FEATURE_SH_STANDALONE(...) __VA_ARGS__
-# define ENABLE_FEATURE_SH_STANDALONE 0
#endif
#if !ENABLE_HUSH_INTERACTIVE
|