aboutsummaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
Diffstat (limited to 'applets')
-rw-r--r--applets/busybox.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/applets/busybox.c b/applets/busybox.c
index 0439fb566..5eb9dfa64 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -89,37 +89,6 @@ int main(int argc, char **argv)
89{ 89{
90 struct BB_applet search_applet, *applet; 90 struct BB_applet search_applet, *applet;
91 const char *s; 91 const char *s;
92 applet_name = "busybox";
93
94#ifdef BB_FEATURE_INSTALLER
95 /*
96 * This style of argument parsing doesn't scale well
97 * in the event that busybox starts wanting more --options.
98 * If someone has a cleaner approach, by all means implement it.
99 */
100 if (argc > 1 && (strcmp(argv[1], "--install") == 0)) {
101 int use_symbolic_links = 0;
102 int rc = 0;
103 char *busybox;
104
105 /* to use symlinks, or not to use symlinks... */
106 if (argc > 2) {
107 if ((strcmp(argv[2], "-s") == 0)) {
108 use_symbolic_links = 1;
109 }
110 }
111
112 /* link */
113 busybox = busybox_fullpath();
114 if (busybox) {
115 install_links(busybox, use_symbolic_links);
116 free(busybox);
117 } else {
118 rc = 1;
119 }
120 return rc;
121 }
122#endif /* BB_FEATURE_INSTALLER */
123 92
124 for (s = applet_name = argv[0]; *s != '\0';) { 93 for (s = applet_name = argv[0]; *s != '\0';) {
125 if (*s++ == '/') 94 if (*s++ == '/')
@@ -144,7 +113,7 @@ int main(int argc, char **argv)
144 exit((*(applet->main)) (argc, argv)); 113 exit((*(applet->main)) (argc, argv));
145 } 114 }
146 115
147 return(busybox_main(argc, argv)); 116 error_msg_and_die("applet not found\n");
148} 117}
149 118
150 119
@@ -152,6 +121,36 @@ int busybox_main(int argc, char **argv)
152{ 121{
153 int col = 0, len, i; 122 int col = 0, len, i;
154 123
124#ifdef BB_FEATURE_INSTALLER
125 /*
126 * This style of argument parsing doesn't scale well
127 * in the event that busybox starts wanting more --options.
128 * If someone has a cleaner approach, by all means implement it.
129 */
130 if (argc > 1 && (strcmp(argv[1], "--install") == 0)) {
131 int use_symbolic_links = 0;
132 int rc = 0;
133 char *busybox;
134
135 /* to use symlinks, or not to use symlinks... */
136 if (argc > 2) {
137 if ((strcmp(argv[2], "-s") == 0)) {
138 use_symbolic_links = 1;
139 }
140 }
141
142 /* link */
143 busybox = busybox_fullpath();
144 if (busybox) {
145 install_links(busybox, use_symbolic_links);
146 free(busybox);
147 } else {
148 rc = 1;
149 }
150 return rc;
151 }
152#endif /* BB_FEATURE_INSTALLER */
153
155 argc--; 154 argc--;
156 155
157 /* If we've already been here once, exit now */ 156 /* If we've already been here once, exit now */