aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-11-30 00:27:06 +0000
committerEric Andersen <andersen@codepoet.org>2000-11-30 00:27:06 +0000
commit8c725e624a6fa97175f48e0fc34b37403e3b8613 (patch)
tree69a9da9b595aef4aa44cb0dd90723f6d8364ddc1
parent8c2d3f46ab4fd7310174a96ca770859dabcf325e (diff)
downloadbusybox-w32-8c725e624a6fa97175f48e0fc34b37403e3b8613.tar.gz
busybox-w32-8c725e624a6fa97175f48e0fc34b37403e3b8613.tar.bz2
busybox-w32-8c725e624a6fa97175f48e0fc34b37403e3b8613.zip
Patch from Larry Doolittle (with minor touchups from me so everything compiles
and works) to use the applet definitions in applets.h to autogenerate the applet function and usage prototypes.
-rw-r--r--Changelog4
-rw-r--r--applets.h253
-rw-r--r--applets/busybox.c4
-rw-r--r--busybox.c4
-rw-r--r--busybox.h247
-rw-r--r--include/applets.h253
-rw-r--r--include/busybox.h247
-rw-r--r--lash.c1
-rw-r--r--sh.c1
-rw-r--r--shell/lash.c1
10 files changed, 302 insertions, 713 deletions
diff --git a/Changelog b/Changelog
index e4be282d5..ee1673fa4 100644
--- a/Changelog
+++ b/Changelog
@@ -13,9 +13,11 @@
13 (it was reading the whole thing and then writing it out). Also 13 (it was reading the whole thing and then writing it out). Also
14 updated usage information (was missing conv=notrunc) and added 14 updated usage information (was missing conv=notrunc) and added
15 conv=sync feature. 15 conv=sync feature.
16 * Larry Doolittle (in collaboration with Matt Kraai) to allow for a 16 * Larry Doolittle (in collaboration with Matt Kraai) -- allow for a
17 pristine source directory -- where all the .o files and such are 17 pristine source directory -- where all the .o files and such are
18 not placed into the source tree. Thanks Larry! 18 not placed into the source tree. Thanks Larry!
19 * Larry Doolittle -- use the applet definitions in applets.h
20 to autogenerate the applet function and usage prototypes.
19 21
20 -Erik Andersen 22 -Erik Andersen
21 23
diff --git a/applets.h b/applets.h
index a747b8619..254924a7a 100644
--- a/applets.h
+++ b/applets.h
@@ -10,366 +10,379 @@
10 * file result in the listing remaining in ascii order. You have been warned. 10 * file result in the listing remaining in ascii order. You have been warned.
11 */ 11 */
12 12
13#ifndef PROTOTYPES
13const struct BB_applet applets[] = { 14const struct BB_applet applets[] = {
15#define APPLET(a,b,c,d) {a,b,c,d},
16#define APPLET_NOUSAGE(a,b,c) {a,b,c,NULL},
17#else
18#define APPLET(a,b,c,d) \
19 extern int b(int argc, char **argv); \
20 extern const char d[];
21#define APPLET_NOUSAGE(a,b,c) \
22 extern int b(int argc, char **argv);
23#endif
14 24
15#ifdef BB_TEST 25#ifdef BB_TEST
16 {"[", test_main, _BB_DIR_USR_BIN, test_usage}, 26 APPLET("[", test_main, _BB_DIR_USR_BIN, test_usage)
17#endif 27#endif
18#ifdef BB_AR 28#ifdef BB_AR
19 {"ar", ar_main, _BB_DIR_USR_BIN, ar_usage}, 29 APPLET("ar", ar_main, _BB_DIR_USR_BIN, ar_usage)
20#endif 30#endif
21#ifdef BB_BASENAME 31#ifdef BB_BASENAME
22 {"basename", basename_main, _BB_DIR_USR_BIN, basename_usage}, 32 APPLET("basename", basename_main, _BB_DIR_USR_BIN, basename_usage)
23#endif 33#endif
24 {"busybox", busybox_main, _BB_DIR_BIN, NULL}, 34 APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN)
25#ifdef BB_CAT 35#ifdef BB_CAT
26 {"cat", cat_main, _BB_DIR_BIN, cat_usage}, 36 APPLET("cat", cat_main, _BB_DIR_BIN, cat_usage)
27#endif 37#endif
28#ifdef BB_CHMOD_CHOWN_CHGRP 38#ifdef BB_CHMOD_CHOWN_CHGRP
29 {"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN, chgrp_usage}, 39 APPLET("chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN, chgrp_usage)
30#endif 40#endif
31#ifdef BB_CHMOD_CHOWN_CHGRP 41#ifdef BB_CHMOD_CHOWN_CHGRP
32 {"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN, chmod_usage}, 42 APPLET("chmod", chmod_chown_chgrp_main, _BB_DIR_BIN, chmod_usage)
33#endif 43#endif
34#ifdef BB_CHMOD_CHOWN_CHGRP 44#ifdef BB_CHMOD_CHOWN_CHGRP
35 {"chown", chmod_chown_chgrp_main, _BB_DIR_BIN, chown_usage}, 45 APPLET("chown", chmod_chown_chgrp_main, _BB_DIR_BIN, chown_usage)
36#endif 46#endif
37#ifdef BB_CHROOT 47#ifdef BB_CHROOT
38 {"chroot", chroot_main, _BB_DIR_USR_SBIN, chroot_usage}, 48 APPLET("chroot", chroot_main, _BB_DIR_USR_SBIN, chroot_usage)
39#endif 49#endif
40#ifdef BB_CHVT 50#ifdef BB_CHVT
41 {"chvt", chvt_main, _BB_DIR_USR_BIN, chvt_usage}, 51 APPLET("chvt", chvt_main, _BB_DIR_USR_BIN, chvt_usage)
42#endif 52#endif
43#ifdef BB_CLEAR 53#ifdef BB_CLEAR
44 {"clear", clear_main, _BB_DIR_USR_BIN, clear_usage}, 54 APPLET("clear", clear_main, _BB_DIR_USR_BIN, clear_usage)
45#endif 55#endif
46#ifdef BB_CMP 56#ifdef BB_CMP
47 {"cmp", cmp_main, _BB_DIR_USR_BIN, cmp_usage}, 57 APPLET("cmp", cmp_main, _BB_DIR_USR_BIN, cmp_usage)
48#endif 58#endif
49#ifdef BB_CP_MV 59#ifdef BB_CP_MV
50 {"cp", cp_mv_main, _BB_DIR_BIN, cp_usage}, 60 APPLET("cp", cp_mv_main, _BB_DIR_BIN, cp_usage)
51#endif 61#endif
52#ifdef BB_CUT 62#ifdef BB_CUT
53 {"cut", cut_main, _BB_DIR_USR_BIN, cut_usage}, 63 APPLET("cut", cut_main, _BB_DIR_USR_BIN, cut_usage)
54#endif 64#endif
55#ifdef BB_DATE 65#ifdef BB_DATE
56 {"date", date_main, _BB_DIR_BIN, date_usage}, 66 APPLET("date", date_main, _BB_DIR_BIN, date_usage)
57#endif 67#endif
58#ifdef BB_DC 68#ifdef BB_DC
59 {"dc", dc_main, _BB_DIR_USR_BIN, dc_usage}, 69 APPLET("dc", dc_main, _BB_DIR_USR_BIN, dc_usage)
60#endif 70#endif
61#ifdef BB_DD 71#ifdef BB_DD
62 {"dd", dd_main, _BB_DIR_BIN, dd_usage}, 72 APPLET("dd", dd_main, _BB_DIR_BIN, dd_usage)
63#endif 73#endif
64#ifdef BB_DEALLOCVT 74#ifdef BB_DEALLOCVT
65 {"deallocvt", deallocvt_main, _BB_DIR_USR_BIN, deallocvt_usage}, 75 APPLET("deallocvt", deallocvt_main, _BB_DIR_USR_BIN, deallocvt_usage)
66#endif 76#endif
67#ifdef BB_DF 77#ifdef BB_DF
68 {"df", df_main, _BB_DIR_BIN, df_usage}, 78 APPLET("df", df_main, _BB_DIR_BIN, df_usage)
69#endif 79#endif
70#ifdef BB_DIRNAME 80#ifdef BB_DIRNAME
71 {"dirname", dirname_main, _BB_DIR_USR_BIN, dirname_usage}, 81 APPLET("dirname", dirname_main, _BB_DIR_USR_BIN, dirname_usage)
72#endif 82#endif
73#ifdef BB_DMESG 83#ifdef BB_DMESG
74 {"dmesg", dmesg_main, _BB_DIR_BIN, dmesg_usage}, 84 APPLET("dmesg", dmesg_main, _BB_DIR_BIN, dmesg_usage)
75#endif 85#endif
76#ifdef BB_DOS2UNIX 86#ifdef BB_DOS2UNIX
77 {"dos2unix", dos2unix_main, _BB_DIR_USR_BIN, dos2unix_usage}, 87 APPLET("dos2unix", dos2unix_main, _BB_DIR_USR_BIN, dos2unix_usage)
78#endif 88#endif
79#ifdef BB_DU 89#ifdef BB_DU
80 {"du", du_main, _BB_DIR_USR_BIN, du_usage}, 90 APPLET("du", du_main, _BB_DIR_USR_BIN, du_usage)
81#endif 91#endif
82#ifdef BB_DUMPKMAP 92#ifdef BB_DUMPKMAP
83 {"dumpkmap", dumpkmap_main, _BB_DIR_BIN, dumpkmap_usage}, 93 APPLET("dumpkmap", dumpkmap_main, _BB_DIR_BIN, dumpkmap_usage)
84#endif 94#endif
85#ifdef BB_DUTMP 95#ifdef BB_DUTMP
86 {"dutmp", dutmp_main, _BB_DIR_USR_SBIN, dutmp_usage}, 96 APPLET("dutmp", dutmp_main, _BB_DIR_USR_SBIN, dutmp_usage)
87#endif 97#endif
88#ifdef BB_ECHO 98#ifdef BB_ECHO
89 {"echo", echo_main, _BB_DIR_BIN, echo_usage}, 99 APPLET("echo", echo_main, _BB_DIR_BIN, echo_usage)
90#endif 100#endif
91#ifdef BB_EXPR 101#ifdef BB_EXPR
92 {"expr", expr_main, _BB_DIR_USR_BIN, expr_usage}, 102 APPLET("expr", expr_main, _BB_DIR_USR_BIN, expr_usage)
93#endif 103#endif
94#ifdef BB_TRUE_FALSE 104#ifdef BB_TRUE_FALSE
95 {"false", false_main, _BB_DIR_BIN, false_usage}, 105 APPLET("false", false_main, _BB_DIR_BIN, false_usage)
96#endif 106#endif
97#ifdef BB_FBSET 107#ifdef BB_FBSET
98 {"fbset", fbset_main, _BB_DIR_USR_SBIN, NULL}, 108 APPLET_NOUSAGE("fbset", fbset_main, _BB_DIR_USR_SBIN)
99#endif 109#endif
100#ifdef BB_FDFLUSH 110#ifdef BB_FDFLUSH
101 {"fdflush", fdflush_main, _BB_DIR_BIN, fdflush_usage}, 111 APPLET("fdflush", fdflush_main, _BB_DIR_BIN, fdflush_usage)
102#endif 112#endif
103#ifdef BB_FIND 113#ifdef BB_FIND
104 {"find", find_main, _BB_DIR_USR_BIN, find_usage}, 114 APPLET("find", find_main, _BB_DIR_USR_BIN, find_usage)
105#endif 115#endif
106#ifdef BB_FREE 116#ifdef BB_FREE
107 {"free", free_main, _BB_DIR_USR_BIN, free_usage}, 117 APPLET("free", free_main, _BB_DIR_USR_BIN, free_usage)
108#endif 118#endif
109#ifdef BB_FREERAMDISK 119#ifdef BB_FREERAMDISK
110 {"freeramdisk", freeramdisk_main, _BB_DIR_SBIN, freeramdisk_usage}, 120 APPLET("freeramdisk", freeramdisk_main, _BB_DIR_SBIN, freeramdisk_usage)
111#endif 121#endif
112#ifdef BB_FSCK_MINIX 122#ifdef BB_FSCK_MINIX
113 {"fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage}, 123 APPLET("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage)
114#endif 124#endif
115#ifdef BB_GETOPT 125#ifdef BB_GETOPT
116 {"getopt", getopt_main, _BB_DIR_BIN, getopt_usage}, 126 APPLET("getopt", getopt_main, _BB_DIR_BIN, getopt_usage)
117#endif 127#endif
118#ifdef BB_GREP 128#ifdef BB_GREP
119 {"grep", grep_main, _BB_DIR_BIN, grep_usage}, 129 APPLET("grep", grep_main, _BB_DIR_BIN, grep_usage)
120#endif 130#endif
121#ifdef BB_GUNZIP 131#ifdef BB_GUNZIP
122 {"gunzip", gunzip_main, _BB_DIR_BIN, gunzip_usage}, 132 APPLET("gunzip", gunzip_main, _BB_DIR_BIN, gunzip_usage)
123#endif 133#endif
124#ifdef BB_GZIP 134#ifdef BB_GZIP
125 {"gzip", gzip_main, _BB_DIR_BIN, gzip_usage}, 135 APPLET("gzip", gzip_main, _BB_DIR_BIN, gzip_usage)
126#endif 136#endif
127#ifdef BB_HALT 137#ifdef BB_HALT
128 {"halt", halt_main, _BB_DIR_SBIN, halt_usage}, 138 APPLET("halt", halt_main, _BB_DIR_SBIN, halt_usage)
129#endif 139#endif
130#ifdef BB_HEAD 140#ifdef BB_HEAD
131 {"head", head_main, _BB_DIR_USR_BIN, head_usage}, 141 APPLET("head", head_main, _BB_DIR_USR_BIN, head_usage)
132#endif 142#endif
133#ifdef BB_HOSTID 143#ifdef BB_HOSTID
134 {"hostid", hostid_main, _BB_DIR_USR_BIN, hostid_usage}, 144 APPLET("hostid", hostid_main, _BB_DIR_USR_BIN, hostid_usage)
135#endif 145#endif
136#ifdef BB_HOSTNAME 146#ifdef BB_HOSTNAME
137 {"hostname", hostname_main, _BB_DIR_BIN, hostname_usage}, 147 APPLET("hostname", hostname_main, _BB_DIR_BIN, hostname_usage)
138#endif 148#endif
139#ifdef BB_ID 149#ifdef BB_ID
140 {"id", id_main, _BB_DIR_USR_BIN, id_usage}, 150 APPLET("id", id_main, _BB_DIR_USR_BIN, id_usage)
141#endif 151#endif
142#ifdef BB_INIT 152#ifdef BB_INIT
143 {"init", init_main, _BB_DIR_SBIN, NULL}, 153 APPLET_NOUSAGE("init", init_main, _BB_DIR_SBIN)
144#endif 154#endif
145#ifdef BB_INSMOD 155#ifdef BB_INSMOD
146 {"insmod", insmod_main, _BB_DIR_SBIN, insmod_usage}, 156 APPLET("insmod", insmod_main, _BB_DIR_SBIN, insmod_usage)
147#endif 157#endif
148#ifdef BB_KILL 158#ifdef BB_KILL
149 {"kill", kill_main, _BB_DIR_BIN, kill_usage}, 159 APPLET("kill", kill_main, _BB_DIR_BIN, kill_usage)
150#endif 160#endif
151#ifdef BB_KILLALL 161#ifdef BB_KILLALL
152 {"killall", kill_main, _BB_DIR_USR_BIN, kill_usage}, 162 APPLET("killall", kill_main, _BB_DIR_USR_BIN, killall_usage)
153#endif 163#endif
154#ifdef BB_LENGTH 164#ifdef BB_LENGTH
155 {"length", length_main, _BB_DIR_USR_BIN, length_usage}, 165 APPLET("length", length_main, _BB_DIR_USR_BIN, length_usage)
156#endif 166#endif
157#ifdef BB_LINUXRC 167#ifdef BB_LINUXRC
158 {"linuxrc", init_main, _BB_DIR_ROOT, NULL}, 168 APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT)
159#endif 169#endif
160#ifdef BB_LN 170#ifdef BB_LN
161 {"ln", ln_main, _BB_DIR_BIN, ln_usage}, 171 APPLET("ln", ln_main, _BB_DIR_BIN, ln_usage)
162#endif 172#endif
163#ifdef BB_LOADACM 173#ifdef BB_LOADACM
164 {"loadacm", loadacm_main, _BB_DIR_USR_BIN, loadacm_usage}, 174 APPLET("loadacm", loadacm_main, _BB_DIR_USR_BIN, loadacm_usage)
165#endif 175#endif
166#ifdef BB_LOADFONT 176#ifdef BB_LOADFONT
167 {"loadfont", loadfont_main, _BB_DIR_USR_BIN, loadfont_usage}, 177 APPLET("loadfont", loadfont_main, _BB_DIR_USR_BIN, loadfont_usage)
168#endif 178#endif
169#ifdef BB_LOADKMAP 179#ifdef BB_LOADKMAP
170 {"loadkmap", loadkmap_main, _BB_DIR_SBIN, loadkmap_usage}, 180 APPLET("loadkmap", loadkmap_main, _BB_DIR_SBIN, loadkmap_usage)
171#endif 181#endif
172#ifdef BB_LOGGER 182#ifdef BB_LOGGER
173 {"logger", logger_main, _BB_DIR_USR_BIN, logger_usage}, 183 APPLET("logger", logger_main, _BB_DIR_USR_BIN, logger_usage)
174#endif 184#endif
175#ifdef BB_LOGNAME 185#ifdef BB_LOGNAME
176 {"logname", logname_main, _BB_DIR_USR_BIN, logname_usage}, 186 APPLET("logname", logname_main, _BB_DIR_USR_BIN, logname_usage)
177#endif 187#endif
178#ifdef BB_LS 188#ifdef BB_LS
179 {"ls", ls_main, _BB_DIR_BIN, ls_usage}, 189 APPLET("ls", ls_main, _BB_DIR_BIN, ls_usage)
180#endif 190#endif
181#ifdef BB_LSMOD 191#ifdef BB_LSMOD
182 {"lsmod", lsmod_main, _BB_DIR_SBIN, lsmod_usage}, 192 APPLET("lsmod", lsmod_main, _BB_DIR_SBIN, lsmod_usage)
183#endif 193#endif
184#ifdef BB_MAKEDEVS 194#ifdef BB_MAKEDEVS
185 {"makedevs", makedevs_main, _BB_DIR_SBIN, makedevs_usage}, 195 APPLET("makedevs", makedevs_main, _BB_DIR_SBIN, makedevs_usage)
186#endif 196#endif
187#ifdef BB_MD5SUM 197#ifdef BB_MD5SUM
188 {"md5sum", md5sum_main, _BB_DIR_USR_BIN, md5sum_usage}, 198 APPLET("md5sum", md5sum_main, _BB_DIR_USR_BIN, md5sum_usage)
189#endif 199#endif
190#ifdef BB_MKDIR 200#ifdef BB_MKDIR
191 {"mkdir", mkdir_main, _BB_DIR_BIN, mkdir_usage}, 201 APPLET("mkdir", mkdir_main, _BB_DIR_BIN, mkdir_usage)
192#endif 202#endif
193#ifdef BB_MKFIFO 203#ifdef BB_MKFIFO
194 {"mkfifo", mkfifo_main, _BB_DIR_USR_BIN, mkfifo_usage}, 204 APPLET("mkfifo", mkfifo_main, _BB_DIR_USR_BIN, mkfifo_usage)
195#endif 205#endif
196#ifdef BB_MKFS_MINIX 206#ifdef BB_MKFS_MINIX
197 {"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage}, 207 APPLET("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage)
198#endif 208#endif
199#ifdef BB_MKNOD 209#ifdef BB_MKNOD
200 {"mknod", mknod_main, _BB_DIR_BIN, mknod_usage}, 210 APPLET("mknod", mknod_main, _BB_DIR_BIN, mknod_usage)
201#endif 211#endif
202#ifdef BB_MKSWAP 212#ifdef BB_MKSWAP
203 {"mkswap", mkswap_main, _BB_DIR_SBIN, mkswap_usage}, 213 APPLET("mkswap", mkswap_main, _BB_DIR_SBIN, mkswap_usage)
204#endif 214#endif
205#ifdef BB_MKTEMP 215#ifdef BB_MKTEMP
206 {"mktemp", mktemp_main, _BB_DIR_BIN, mktemp_usage}, 216 APPLET("mktemp", mktemp_main, _BB_DIR_BIN, mktemp_usage)
207#endif 217#endif
208#ifdef BB_MORE 218#ifdef BB_MORE
209 {"more", more_main, _BB_DIR_BIN, more_usage}, 219 APPLET("more", more_main, _BB_DIR_BIN, more_usage)
210#endif 220#endif
211#ifdef BB_MOUNT 221#ifdef BB_MOUNT
212 {"mount", mount_main, _BB_DIR_BIN, mount_usage}, 222 APPLET("mount", mount_main, _BB_DIR_BIN, mount_usage)
213#endif 223#endif
214#ifdef BB_MT 224#ifdef BB_MT
215 {"mt", mt_main, _BB_DIR_BIN, mt_usage}, 225 APPLET("mt", mt_main, _BB_DIR_BIN, mt_usage)
216#endif 226#endif
217#ifdef BB_CP_MV 227#ifdef BB_CP_MV
218 {"mv", cp_mv_main, _BB_DIR_BIN, mv_usage}, 228 APPLET("mv", cp_mv_main, _BB_DIR_BIN, mv_usage)
219#endif 229#endif
220#ifdef BB_NC 230#ifdef BB_NC
221 {"nc", nc_main, _BB_DIR_USR_BIN, nc_usage}, 231 APPLET("nc", nc_main, _BB_DIR_USR_BIN, nc_usage)
222#endif 232#endif
223#ifdef BB_NSLOOKUP 233#ifdef BB_NSLOOKUP
224 {"nslookup", nslookup_main, _BB_DIR_USR_BIN, nslookup_usage}, 234 APPLET("nslookup", nslookup_main, _BB_DIR_USR_BIN, nslookup_usage)
225#endif 235#endif
226#ifdef BB_PING 236#ifdef BB_PING
227 {"ping", ping_main, _BB_DIR_BIN, ping_usage}, 237 APPLET("ping", ping_main, _BB_DIR_BIN, ping_usage)
228#endif 238#endif
229#ifdef BB_POWEROFF 239#ifdef BB_POWEROFF
230 {"poweroff", poweroff_main, _BB_DIR_SBIN, poweroff_usage}, 240 APPLET("poweroff", poweroff_main, _BB_DIR_SBIN, poweroff_usage)
231#endif 241#endif
232#ifdef BB_PRINTF 242#ifdef BB_PRINTF
233 {"printf", printf_main, _BB_DIR_USR_BIN, printf_usage}, 243 APPLET("printf", printf_main, _BB_DIR_USR_BIN, printf_usage)
234#endif 244#endif
235#ifdef BB_PS 245#ifdef BB_PS
236 {"ps", ps_main, _BB_DIR_BIN, ps_usage}, 246 APPLET("ps", ps_main, _BB_DIR_BIN, ps_usage)
237#endif 247#endif
238#ifdef BB_PWD 248#ifdef BB_PWD
239 {"pwd", pwd_main, _BB_DIR_BIN, pwd_usage}, 249 APPLET("pwd", pwd_main, _BB_DIR_BIN, pwd_usage)
240#endif 250#endif
241#ifdef BB_RDATE 251#ifdef BB_RDATE
242 {"rdate", rdate_main, _BB_DIR_USR_BIN, rdate_usage}, 252 APPLET("rdate", rdate_main, _BB_DIR_USR_BIN, rdate_usage)
243#endif 253#endif
244#ifdef BB_READLINK 254#ifdef BB_READLINK
245 {"readlink", readlink_main, _BB_DIR_USR_BIN, readlink_usage}, 255 APPLET("readlink", readlink_main, _BB_DIR_USR_BIN, readlink_usage)
246#endif 256#endif
247#ifdef BB_REBOOT 257#ifdef BB_REBOOT
248 {"reboot", reboot_main, _BB_DIR_SBIN, reboot_usage}, 258 APPLET("reboot", reboot_main, _BB_DIR_SBIN, reboot_usage)
249#endif 259#endif
250#ifdef BB_RENICE 260#ifdef BB_RENICE
251 {"renice", renice_main, _BB_DIR_USR_BIN, renice_usage}, 261 APPLET("renice", renice_main, _BB_DIR_USR_BIN, renice_usage)
252#endif 262#endif
253#ifdef BB_RESET 263#ifdef BB_RESET
254 {"reset", reset_main, _BB_DIR_USR_BIN, reset_usage}, 264 APPLET("reset", reset_main, _BB_DIR_USR_BIN, reset_usage)
255#endif 265#endif
256#ifdef BB_RM 266#ifdef BB_RM
257 {"rm", rm_main, _BB_DIR_BIN, rm_usage}, 267 APPLET("rm", rm_main, _BB_DIR_BIN, rm_usage)
258#endif 268#endif
259#ifdef BB_RMDIR 269#ifdef BB_RMDIR
260 {"rmdir", rmdir_main, _BB_DIR_BIN, rmdir_usage}, 270 APPLET("rmdir", rmdir_main, _BB_DIR_BIN, rmdir_usage)
261#endif 271#endif
262#ifdef BB_RMMOD 272#ifdef BB_RMMOD
263 {"rmmod", rmmod_main, _BB_DIR_SBIN, rmmod_usage}, 273 APPLET("rmmod", rmmod_main, _BB_DIR_SBIN, rmmod_usage)
264#endif 274#endif
265#ifdef BB_RPMUNPACK 275#ifdef BB_RPMUNPACK
266 {"rpmunpack", rpmunpack_main, _BB_DIR_USR_BIN, rpmunpack_usage}, 276 APPLET("rpmunpack", rpmunpack_main, _BB_DIR_USR_BIN, rpmunpack_usage)
267#endif 277#endif
268#ifdef BB_SED 278#ifdef BB_SED
269 {"sed", sed_main, _BB_DIR_BIN, sed_usage}, 279 APPLET("sed", sed_main, _BB_DIR_BIN, sed_usage)
270#endif 280#endif
271#ifdef BB_SETKEYCODES 281#ifdef BB_SETKEYCODES
272 {"setkeycodes", setkeycodes_main, _BB_DIR_USR_BIN, setkeycodes_usage}, 282 APPLET("setkeycodes", setkeycodes_main, _BB_DIR_USR_BIN, setkeycodes_usage)
273#endif 283#endif
274#ifdef BB_SH 284#ifdef BB_SH
275 {"sh", shell_main, _BB_DIR_BIN, shell_usage}, 285 APPLET("sh", shell_main, _BB_DIR_BIN, shell_usage)
276#endif 286#endif
277#ifdef BB_SLEEP 287#ifdef BB_SLEEP
278 {"sleep", sleep_main, _BB_DIR_BIN, sleep_usage}, 288 APPLET("sleep", sleep_main, _BB_DIR_BIN, sleep_usage)
279#endif 289#endif
280#ifdef BB_SORT 290#ifdef BB_SORT
281 {"sort", sort_main, _BB_DIR_USR_BIN, sort_usage}, 291 APPLET("sort", sort_main, _BB_DIR_USR_BIN, sort_usage)
282#endif 292#endif
283#ifdef BB_SWAPONOFF 293#ifdef BB_SWAPONOFF
284 {"swapoff", swap_on_off_main, _BB_DIR_SBIN, swapoff_usage}, 294 APPLET("swapoff", swap_on_off_main, _BB_DIR_SBIN, swapoff_usage)
285#endif 295#endif
286#ifdef BB_SWAPONOFF 296#ifdef BB_SWAPONOFF
287 {"swapon", swap_on_off_main, _BB_DIR_SBIN, swapon_usage}, 297 APPLET("swapon", swap_on_off_main, _BB_DIR_SBIN, swapon_usage)
288#endif 298#endif
289#ifdef BB_SYNC 299#ifdef BB_SYNC
290 {"sync", sync_main, _BB_DIR_BIN, sync_usage}, 300 APPLET("sync", sync_main, _BB_DIR_BIN, sync_usage)
291#endif 301#endif
292#ifdef BB_SYSLOGD 302#ifdef BB_SYSLOGD
293 {"syslogd", syslogd_main, _BB_DIR_SBIN, syslogd_usage}, 303 APPLET("syslogd", syslogd_main, _BB_DIR_SBIN, syslogd_usage)
294#endif 304#endif
295#ifdef BB_TAIL 305#ifdef BB_TAIL
296 {"tail", tail_main, _BB_DIR_USR_BIN, tail_usage}, 306 APPLET("tail", tail_main, _BB_DIR_USR_BIN, tail_usage)
297#endif 307#endif
298#ifdef BB_TAR 308#ifdef BB_TAR
299 {"tar", tar_main, _BB_DIR_BIN, tar_usage}, 309 APPLET("tar", tar_main, _BB_DIR_BIN, tar_usage)
300#endif 310#endif
301#ifdef BB_TEE 311#ifdef BB_TEE
302 {"tee", tee_main, _BB_DIR_USR_BIN, tee_usage}, 312 APPLET("tee", tee_main, _BB_DIR_USR_BIN, tee_usage)
303#endif 313#endif
304#ifdef BB_TELNET 314#ifdef BB_TELNET
305 {"telnet", telnet_main, _BB_DIR_USR_BIN, telnet_usage}, 315 APPLET("telnet", telnet_main, _BB_DIR_USR_BIN, telnet_usage)
306#endif 316#endif
307#ifdef BB_TEST 317#ifdef BB_TEST
308 {"test", test_main, _BB_DIR_USR_BIN, test_usage}, 318 APPLET("test", test_main, _BB_DIR_USR_BIN, test_usage)
309#endif 319#endif
310#ifdef BB_TOUCH 320#ifdef BB_TOUCH
311 {"touch", touch_main, _BB_DIR_BIN, touch_usage}, 321 APPLET("touch", touch_main, _BB_DIR_BIN, touch_usage)
312#endif 322#endif
313#ifdef BB_TR 323#ifdef BB_TR
314 {"tr", tr_main, _BB_DIR_USR_BIN, tr_usage}, 324 APPLET("tr", tr_main, _BB_DIR_USR_BIN, tr_usage)
315#endif 325#endif
316#ifdef BB_TRUE_FALSE 326#ifdef BB_TRUE_FALSE
317 {"true", true_main, _BB_DIR_BIN, true_usage}, 327 APPLET("true", true_main, _BB_DIR_BIN, true_usage)
318#endif 328#endif
319#ifdef BB_TTY 329#ifdef BB_TTY
320 {"tty", tty_main, _BB_DIR_USR_BIN, tty_usage}, 330 APPLET("tty", tty_main, _BB_DIR_USR_BIN, tty_usage)
321#endif 331#endif
322#ifdef BB_UMOUNT 332#ifdef BB_UMOUNT
323 {"umount", umount_main, _BB_DIR_BIN, umount_usage}, 333 APPLET("umount", umount_main, _BB_DIR_BIN, umount_usage)
324#endif 334#endif
325#ifdef BB_UNAME 335#ifdef BB_UNAME
326 {"uname", uname_main, _BB_DIR_BIN, uname_usage}, 336 APPLET("uname", uname_main, _BB_DIR_BIN, uname_usage)
327#endif 337#endif
328#ifdef BB_UNIQ 338#ifdef BB_UNIQ
329 {"uniq", uniq_main, _BB_DIR_USR_BIN, uniq_usage}, 339 APPLET("uniq", uniq_main, _BB_DIR_USR_BIN, uniq_usage)
330#endif 340#endif
331#ifdef BB_UNIX2DOS 341#ifdef BB_UNIX2DOS
332 {"unix2dos", unix2dos_main, _BB_DIR_USR_BIN, unix2dos_usage}, 342 APPLET("unix2dos", unix2dos_main, _BB_DIR_USR_BIN, unix2dos_usage)
333#endif 343#endif
334#ifdef BB_UPDATE 344#ifdef BB_UPDATE
335 {"update", update_main, _BB_DIR_SBIN, update_usage}, 345 APPLET("update", update_main, _BB_DIR_SBIN, update_usage)
336#endif 346#endif
337#ifdef BB_UPTIME 347#ifdef BB_UPTIME
338 {"uptime", uptime_main, _BB_DIR_USR_BIN, uptime_usage}, 348 APPLET("uptime", uptime_main, _BB_DIR_USR_BIN, uptime_usage)
339#endif 349#endif
340#ifdef BB_USLEEP 350#ifdef BB_USLEEP
341 {"usleep", usleep_main, _BB_DIR_BIN, usleep_usage}, 351 APPLET("usleep", usleep_main, _BB_DIR_BIN, usleep_usage)
342#endif 352#endif
343#ifdef BB_UUDECODE 353#ifdef BB_UUDECODE
344 {"uudecode", uudecode_main, _BB_DIR_USR_BIN, uudecode_usage}, 354 APPLET("uudecode", uudecode_main, _BB_DIR_USR_BIN, uudecode_usage)
345#endif 355#endif
346#ifdef BB_UUENCODE 356#ifdef BB_UUENCODE
347 {"uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage}, 357 APPLET("uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage)
348#endif 358#endif
349#ifdef BB_WC 359#ifdef BB_WC
350 {"wc", wc_main, _BB_DIR_USR_BIN, wc_usage}, 360 APPLET("wc", wc_main, _BB_DIR_USR_BIN, wc_usage)
351#endif 361#endif
352#ifdef BB_WGET 362#ifdef BB_WGET
353 {"wget", wget_main, _BB_DIR_USR_BIN, wget_usage}, 363 APPLET("wget", wget_main, _BB_DIR_USR_BIN, wget_usage)
354#endif 364#endif
355#ifdef BB_WHICH 365#ifdef BB_WHICH
356 {"which", which_main, _BB_DIR_USR_BIN, which_usage}, 366 APPLET("which", which_main, _BB_DIR_USR_BIN, which_usage)
357#endif 367#endif
358#ifdef BB_WHOAMI 368#ifdef BB_WHOAMI
359 {"whoami", whoami_main, _BB_DIR_USR_BIN, whoami_usage}, 369 APPLET("whoami", whoami_main, _BB_DIR_USR_BIN, whoami_usage)
360#endif 370#endif
361#ifdef BB_XARGS 371#ifdef BB_XARGS
362 {"xargs", xargs_main, _BB_DIR_USR_BIN, xargs_usage}, 372 APPLET("xargs", xargs_main, _BB_DIR_USR_BIN, xargs_usage)
363#endif 373#endif
364#ifdef BB_YES 374#ifdef BB_YES
365 {"yes", yes_main, _BB_DIR_USR_BIN, yes_usage}, 375 APPLET("yes", yes_main, _BB_DIR_USR_BIN, yes_usage)
366#endif 376#endif
367#ifdef BB_GUNZIP 377#ifdef BB_GUNZIP
368 {"zcat", gunzip_main, _BB_DIR_BIN, gunzip_usage}, 378 APPLET("zcat", gunzip_main, _BB_DIR_BIN, gunzip_usage)
369#endif 379#endif
370 {0,NULL,0,NULL} 380
381#ifndef PROTOTYPES
382 { 0,NULL,0,NULL}
371}; 383};
372 384
373/* The -1 arises because of the {0,NULL,0,NULL} entry above. */ 385/* The -1 arises because of the {0,NULL,0,NULL} entry above. */
374size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1); 386size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
375 387
388#endif
diff --git a/applets/busybox.c b/applets/busybox.c
index 0a3333d99..857367b5f 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -3,6 +3,10 @@
3#include <stdio.h> 3#include <stdio.h>
4#include <string.h> 4#include <string.h>
5#include <errno.h> 5#include <errno.h>
6
7#undef APPLET
8#undef APPLET_NOUSAGE
9#undef PROTOTYPES
6#include "applets.h" 10#include "applets.h"
7 11
8#define bb_need_full_version 12#define bb_need_full_version
diff --git a/busybox.c b/busybox.c
index 0a3333d99..857367b5f 100644
--- a/busybox.c
+++ b/busybox.c
@@ -3,6 +3,10 @@
3#include <stdio.h> 3#include <stdio.h>
4#include <string.h> 4#include <string.h>
5#include <errno.h> 5#include <errno.h>
6
7#undef APPLET
8#undef APPLET_NOUSAGE
9#undef PROTOTYPES
6#include "applets.h" 10#include "applets.h"
7 11
8#define bb_need_full_version 12#define bb_need_full_version
diff --git a/busybox.h b/busybox.h
index 3fc91a387..cff4af41d 100644
--- a/busybox.h
+++ b/busybox.h
@@ -108,244 +108,19 @@ struct BB_applet {
108/* From busybox.c */ 108/* From busybox.c */
109extern const struct BB_applet applets[]; 109extern const struct BB_applet applets[];
110 110
111extern size_t NUM_APPLETS; 111/* Automagically pull in all the applet function prototypes and
112 112 * applet usage strings.
113 113 * These are all of the form:
114extern int applet_name_compare(const void *x, const void *y); 114 * extern int foo_main(int argc, char **argv);
115 115 * extern const char foo_usage[];
116extern int ar_main(int argc, char **argv); 116 * These are all autogenerated from the set of currently defined applets.
117extern int basename_main(int argc, char **argv); 117 */
118extern int bogomips_main(int argc, char **argv); 118#define PROTOTYPES
119extern int busybox_main(int argc, char** argv); 119#include "applets.h"
120extern int cat_main(int argc, char** argv); 120#undef PROTOTYPES
121extern int chmod_chown_chgrp_main(int argc, char** argv);
122extern int chroot_main(int argc, char** argv);
123extern int chvt_main(int argc, char** argv);
124extern int clear_main(int argc, char** argv);
125extern int cmp_main(int argc, char** argv);
126extern int cp_mv_main(int argc, char** argv);
127extern int cut_main(int argc, char** argv);
128extern int date_main(int argc, char** argv);
129extern int dc_main(int argc, char** argv);
130extern int dd_main(int argc, char** argv);
131extern int dirname_main(int argc, char** argv);
132extern int deallocvt_main(int argc, char** argv);
133extern int df_main(int argc, char** argv);
134extern int dmesg_main(int argc, char** argv);
135extern int dos2unix_main(int argc, char** argv);
136extern int du_main(int argc, char** argv);
137extern int dumpkmap_main(int argc, char** argv);
138extern int dutmp_main(int argc, char** argv);
139extern int echo_main(int argc, char** argv);
140extern int expr_main(int argc, char** argv);
141extern int false_main(int argc, char** argv);
142extern int fbset_main(int argc, char** argv);
143extern int fdisk_main(int argc, char** argv);
144extern int fdflush_main(int argc, char **argv);
145extern int fsck_minix_main(int argc, char **argv);
146extern int find_main(int argc, char** argv);
147extern int free_main(int argc, char** argv);
148extern int freeramdisk_main(int argc, char** argv);
149extern int getopt_main(int argc, char** argv);
150extern int grep_main(int argc, char** argv);
151extern int gunzip_main (int argc, char** argv);
152extern int gzip_main(int argc, char** argv);
153extern int halt_main(int argc, char** argv);
154extern int head_main(int argc, char** argv);
155extern int hostid_main(int argc, char** argv);
156extern int hostname_main(int argc, char** argv);
157extern int id_main(int argc, char** argv);
158extern int init_main(int argc, char** argv);
159extern int insmod_main(int argc, char** argv);
160extern int kill_main(int argc, char** argv);
161extern int length_main(int argc, char** argv);
162extern int ln_main(int argc, char** argv);
163extern int loadacm_main(int argc, char** argv);
164extern int loadfont_main(int argc, char** argv);
165extern int loadkmap_main(int argc, char** argv);
166extern int losetup_main(int argc, char** argv);
167extern int logger_main(int argc, char **argv);
168extern int logname_main(int argc, char **argv);
169extern int ls_main(int argc, char** argv);
170extern int lsmod_main(int argc, char** argv);
171extern int makedevs_main(int argc, char** argv);
172extern int md5sum_main(int argc, char** argv);
173extern int mkdir_main(int argc, char** argv);
174extern int mkfifo_main(int argc, char **argv);
175extern int mkfs_minix_main(int argc, char **argv);
176extern int mknod_main(int argc, char** argv);
177extern int mkswap_main(int argc, char** argv);
178extern int mktemp_main(int argc, char **argv);
179extern int nc_main(int argc, char** argv);
180extern int more_main(int argc, char** argv);
181extern int mount_main(int argc, char** argv);
182extern int mt_main(int argc, char** argv);
183extern int nslookup_main(int argc, char **argv);
184extern int ping_main(int argc, char **argv);
185extern int poweroff_main(int argc, char **argv);
186extern int printf_main(int argc, char** argv);
187extern int ps_main(int argc, char** argv);
188extern int pwd_main(int argc, char** argv);
189extern int rdate_main(int argc, char** argv);
190extern int readlink_main(int argc, char** argv);
191extern int reboot_main(int argc, char** argv);
192extern int renice_main(int argc, char** argv);
193extern int reset_main(int argc, char** argv);
194extern int rm_main(int argc, char** argv);
195extern int rmdir_main(int argc, char **argv);
196extern int rmmod_main(int argc, char** argv);
197extern int rpmunpack_main(int argc, char** argv);
198extern int sed_main(int argc, char** argv);
199extern int sfdisk_main(int argc, char** argv);
200extern int setkeycodes_main(int argc, char** argv);
201extern int shell_main(int argc, char** argv);
202extern int sleep_main(int argc, char** argv);
203extern int sort_main(int argc, char** argv);
204extern int swap_on_off_main(int argc, char** argv);
205extern int sync_main(int argc, char** argv);
206extern int syslogd_main(int argc, char **argv);
207extern int tail_main(int argc, char** argv);
208extern int tar_main(int argc, char** argv);
209extern int tee_main(int argc, char** argv);
210extern int test_main(int argc, char** argv);
211extern int telnet_main(int argc, char** argv);
212extern int touch_main(int argc, char** argv);
213extern int tr_main(int argc, char** argv);
214extern int true_main(int argc, char** argv);
215extern int tput_main(int argc, char** argv);
216extern int tryopen_main(int argc, char** argv);
217extern int tty_main(int argc, char** argv);
218extern int umount_main(int argc, char** argv);
219extern int uname_main(int argc, char** argv);
220extern int uniq_main(int argc, char** argv);
221extern int unix2dos_main(int argc, char** argv);
222extern int update_main(int argc, char** argv);
223extern int uptime_main(int argc, char** argv);
224extern int usleep_main(int argc, char** argv);
225extern int uuencode_main(int argc, char** argv);
226extern int uudecode_main(int argc, char** argv);
227extern int wc_main(int argc, char** argv);
228extern int wget_main(int argc, char** argv);
229extern int which_main(int argc, char** argv);
230extern int whoami_main(int argc, char** argv);
231extern int xargs_main(int argc, char** argv);
232extern int yes_main(int argc, char** argv);
233
234extern const char ar_usage[];
235extern const char basename_usage[];
236extern const char cat_usage[];
237extern const char chgrp_usage[];
238extern const char chmod_usage[];
239extern const char chown_usage[];
240extern const char chroot_usage[];
241extern const char chvt_usage[];
242extern const char clear_usage[];
243extern const char cmp_usage[];
244extern const char cp_usage[];
245extern const char cut_usage[];
246extern const char date_usage[];
247extern const char dc_usage[];
248extern const char dd_usage[];
249extern const char deallocvt_usage[];
250extern const char df_usage[];
251extern const char dirname_usage[];
252extern const char dmesg_usage[];
253extern const char dos2unix_usage[];
254extern const char du_usage[];
255extern const char dumpkmap_usage[];
256extern const char dutmp_usage[];
257extern const char echo_usage[];
258extern const char expr_usage[];
259extern const char false_usage[];
260extern const char fdflush_usage[];
261extern const char find_usage[];
262extern const char free_usage[];
263extern const char freeramdisk_usage[];
264extern const char fsck_minix_usage[];
265extern const char getopt_usage[];
266extern const char grep_usage[];
267extern const char gunzip_usage[];
268extern const char gzip_usage[];
269extern const char halt_usage[];
270extern const char head_usage[];
271extern const char hostid_usage[];
272extern const char hostname_usage[];
273extern const char id_usage[];
274extern const char insmod_usage[];
275extern const char kill_usage[];
276extern const char killall_usage[];
277extern const char length_usage[];
278extern const char ln_usage[];
279extern const char loadacm_usage[];
280extern const char loadfont_usage[];
281extern const char loadkmap_usage[];
282extern const char logger_usage[];
283extern const char logname_usage[];
284extern const char ls_usage[];
285extern const char lsmod_usage[];
286extern const char makedevs_usage[];
287extern const char md5sum_usage[];
288extern const char mkdir_usage[];
289extern const char mkfifo_usage[];
290extern const char mkfs_minix_usage[];
291extern const char mknod_usage[];
292extern const char mkswap_usage[];
293extern const char mktemp_usage[];
294extern const char more_usage[];
295extern const char mount_usage[];
296extern const char mt_usage[];
297extern const char mv_usage[];
298extern const char nc_usage[];
299extern const char nslookup_usage[];
300extern const char ping_usage[];
301extern const char poweroff_usage[];
302extern const char printf_usage[];
303extern const char ps_usage[];
304extern const char pwd_usage[];
305extern const char rdate_usage[];
306extern const char readlink_usage[];
307extern const char reboot_usage[];
308extern const char renice_usage[];
309extern const char reset_usage[];
310extern const char rm_usage[];
311extern const char rmdir_usage[];
312extern const char rmmod_usage[];
313extern const char rpmunpack_usage[];
314extern const char sed_usage[];
315extern const char setkeycodes_usage[];
316extern const char shell_usage[];
317extern const char sleep_usage[];
318extern const char sort_usage[];
319extern const char swapoff_usage[];
320extern const char swapon_usage[];
321extern const char sync_usage[];
322extern const char syslogd_usage[];
323extern const char tail_usage[];
324extern const char tar_usage[];
325extern const char tee_usage[];
326extern const char telnet_usage[];
327extern const char test_usage[];
328extern const char touch_usage[];
329extern const char tr_usage[];
330extern const char true_usage[];
331extern const char tty_usage[];
332extern const char umount_usage[];
333extern const char uname_usage[];
334extern const char uniq_usage[];
335extern const char unix2dos_usage[];
336extern const char update_usage[];
337extern const char uptime_usage[];
338extern const char usleep_usage[];
339extern const char uudecode_usage[];
340extern const char uuencode_usage[];
341extern const char wc_usage[];
342extern const char wget_usage[];
343extern const char which_usage[];
344extern const char whoami_usage[];
345extern const char xargs_usage[];
346extern const char yes_usage[];
347 121
348extern const char *applet_name; 122extern const char *applet_name;
123extern int applet_name_compare(const void *x, const void *y);
349 124
350extern void usage(const char *usage) __attribute__ ((noreturn)); 125extern void usage(const char *usage) __attribute__ ((noreturn));
351extern void errorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 126extern void errorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
diff --git a/include/applets.h b/include/applets.h
index a747b8619..254924a7a 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -10,366 +10,379 @@
10 * file result in the listing remaining in ascii order. You have been warned. 10 * file result in the listing remaining in ascii order. You have been warned.
11 */ 11 */
12 12
13#ifndef PROTOTYPES
13const struct BB_applet applets[] = { 14const struct BB_applet applets[] = {
15#define APPLET(a,b,c,d) {a,b,c,d},
16#define APPLET_NOUSAGE(a,b,c) {a,b,c,NULL},
17#else
18#define APPLET(a,b,c,d) \
19 extern int b(int argc, char **argv); \
20 extern const char d[];
21#define APPLET_NOUSAGE(a,b,c) \
22 extern int b(int argc, char **argv);
23#endif
14 24
15#ifdef BB_TEST 25#ifdef BB_TEST
16 {"[", test_main, _BB_DIR_USR_BIN, test_usage}, 26 APPLET("[", test_main, _BB_DIR_USR_BIN, test_usage)
17#endif 27#endif
18#ifdef BB_AR 28#ifdef BB_AR
19 {"ar", ar_main, _BB_DIR_USR_BIN, ar_usage}, 29 APPLET("ar", ar_main, _BB_DIR_USR_BIN, ar_usage)
20#endif 30#endif
21#ifdef BB_BASENAME 31#ifdef BB_BASENAME
22 {"basename", basename_main, _BB_DIR_USR_BIN, basename_usage}, 32 APPLET("basename", basename_main, _BB_DIR_USR_BIN, basename_usage)
23#endif 33#endif
24 {"busybox", busybox_main, _BB_DIR_BIN, NULL}, 34 APPLET_NOUSAGE("busybox", busybox_main, _BB_DIR_BIN)
25#ifdef BB_CAT 35#ifdef BB_CAT
26 {"cat", cat_main, _BB_DIR_BIN, cat_usage}, 36 APPLET("cat", cat_main, _BB_DIR_BIN, cat_usage)
27#endif 37#endif
28#ifdef BB_CHMOD_CHOWN_CHGRP 38#ifdef BB_CHMOD_CHOWN_CHGRP
29 {"chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN, chgrp_usage}, 39 APPLET("chgrp", chmod_chown_chgrp_main, _BB_DIR_BIN, chgrp_usage)
30#endif 40#endif
31#ifdef BB_CHMOD_CHOWN_CHGRP 41#ifdef BB_CHMOD_CHOWN_CHGRP
32 {"chmod", chmod_chown_chgrp_main, _BB_DIR_BIN, chmod_usage}, 42 APPLET("chmod", chmod_chown_chgrp_main, _BB_DIR_BIN, chmod_usage)
33#endif 43#endif
34#ifdef BB_CHMOD_CHOWN_CHGRP 44#ifdef BB_CHMOD_CHOWN_CHGRP
35 {"chown", chmod_chown_chgrp_main, _BB_DIR_BIN, chown_usage}, 45 APPLET("chown", chmod_chown_chgrp_main, _BB_DIR_BIN, chown_usage)
36#endif 46#endif
37#ifdef BB_CHROOT 47#ifdef BB_CHROOT
38 {"chroot", chroot_main, _BB_DIR_USR_SBIN, chroot_usage}, 48 APPLET("chroot", chroot_main, _BB_DIR_USR_SBIN, chroot_usage)
39#endif 49#endif
40#ifdef BB_CHVT 50#ifdef BB_CHVT
41 {"chvt", chvt_main, _BB_DIR_USR_BIN, chvt_usage}, 51 APPLET("chvt", chvt_main, _BB_DIR_USR_BIN, chvt_usage)
42#endif 52#endif
43#ifdef BB_CLEAR 53#ifdef BB_CLEAR
44 {"clear", clear_main, _BB_DIR_USR_BIN, clear_usage}, 54 APPLET("clear", clear_main, _BB_DIR_USR_BIN, clear_usage)
45#endif 55#endif
46#ifdef BB_CMP 56#ifdef BB_CMP
47 {"cmp", cmp_main, _BB_DIR_USR_BIN, cmp_usage}, 57 APPLET("cmp", cmp_main, _BB_DIR_USR_BIN, cmp_usage)
48#endif 58#endif
49#ifdef BB_CP_MV 59#ifdef BB_CP_MV
50 {"cp", cp_mv_main, _BB_DIR_BIN, cp_usage}, 60 APPLET("cp", cp_mv_main, _BB_DIR_BIN, cp_usage)
51#endif 61#endif
52#ifdef BB_CUT 62#ifdef BB_CUT
53 {"cut", cut_main, _BB_DIR_USR_BIN, cut_usage}, 63 APPLET("cut", cut_main, _BB_DIR_USR_BIN, cut_usage)
54#endif 64#endif
55#ifdef BB_DATE 65#ifdef BB_DATE
56 {"date", date_main, _BB_DIR_BIN, date_usage}, 66 APPLET("date", date_main, _BB_DIR_BIN, date_usage)
57#endif 67#endif
58#ifdef BB_DC 68#ifdef BB_DC
59 {"dc", dc_main, _BB_DIR_USR_BIN, dc_usage}, 69 APPLET("dc", dc_main, _BB_DIR_USR_BIN, dc_usage)
60#endif 70#endif
61#ifdef BB_DD 71#ifdef BB_DD
62 {"dd", dd_main, _BB_DIR_BIN, dd_usage}, 72 APPLET("dd", dd_main, _BB_DIR_BIN, dd_usage)
63#endif 73#endif
64#ifdef BB_DEALLOCVT 74#ifdef BB_DEALLOCVT
65 {"deallocvt", deallocvt_main, _BB_DIR_USR_BIN, deallocvt_usage}, 75 APPLET("deallocvt", deallocvt_main, _BB_DIR_USR_BIN, deallocvt_usage)
66#endif 76#endif
67#ifdef BB_DF 77#ifdef BB_DF
68 {"df", df_main, _BB_DIR_BIN, df_usage}, 78 APPLET("df", df_main, _BB_DIR_BIN, df_usage)
69#endif 79#endif
70#ifdef BB_DIRNAME 80#ifdef BB_DIRNAME
71 {"dirname", dirname_main, _BB_DIR_USR_BIN, dirname_usage}, 81 APPLET("dirname", dirname_main, _BB_DIR_USR_BIN, dirname_usage)
72#endif 82#endif
73#ifdef BB_DMESG 83#ifdef BB_DMESG
74 {"dmesg", dmesg_main, _BB_DIR_BIN, dmesg_usage}, 84 APPLET("dmesg", dmesg_main, _BB_DIR_BIN, dmesg_usage)
75#endif 85#endif
76#ifdef BB_DOS2UNIX 86#ifdef BB_DOS2UNIX
77 {"dos2unix", dos2unix_main, _BB_DIR_USR_BIN, dos2unix_usage}, 87 APPLET("dos2unix", dos2unix_main, _BB_DIR_USR_BIN, dos2unix_usage)
78#endif 88#endif
79#ifdef BB_DU 89#ifdef BB_DU
80 {"du", du_main, _BB_DIR_USR_BIN, du_usage}, 90 APPLET("du", du_main, _BB_DIR_USR_BIN, du_usage)
81#endif 91#endif
82#ifdef BB_DUMPKMAP 92#ifdef BB_DUMPKMAP
83 {"dumpkmap", dumpkmap_main, _BB_DIR_BIN, dumpkmap_usage}, 93 APPLET("dumpkmap", dumpkmap_main, _BB_DIR_BIN, dumpkmap_usage)
84#endif 94#endif
85#ifdef BB_DUTMP 95#ifdef BB_DUTMP
86 {"dutmp", dutmp_main, _BB_DIR_USR_SBIN, dutmp_usage}, 96 APPLET("dutmp", dutmp_main, _BB_DIR_USR_SBIN, dutmp_usage)
87#endif 97#endif
88#ifdef BB_ECHO 98#ifdef BB_ECHO
89 {"echo", echo_main, _BB_DIR_BIN, echo_usage}, 99 APPLET("echo", echo_main, _BB_DIR_BIN, echo_usage)
90#endif 100#endif
91#ifdef BB_EXPR 101#ifdef BB_EXPR
92 {"expr", expr_main, _BB_DIR_USR_BIN, expr_usage}, 102 APPLET("expr", expr_main, _BB_DIR_USR_BIN, expr_usage)
93#endif 103#endif
94#ifdef BB_TRUE_FALSE 104#ifdef BB_TRUE_FALSE
95 {"false", false_main, _BB_DIR_BIN, false_usage}, 105 APPLET("false", false_main, _BB_DIR_BIN, false_usage)
96#endif 106#endif
97#ifdef BB_FBSET 107#ifdef BB_FBSET
98 {"fbset", fbset_main, _BB_DIR_USR_SBIN, NULL}, 108 APPLET_NOUSAGE("fbset", fbset_main, _BB_DIR_USR_SBIN)
99#endif 109#endif
100#ifdef BB_FDFLUSH 110#ifdef BB_FDFLUSH
101 {"fdflush", fdflush_main, _BB_DIR_BIN, fdflush_usage}, 111 APPLET("fdflush", fdflush_main, _BB_DIR_BIN, fdflush_usage)
102#endif 112#endif
103#ifdef BB_FIND 113#ifdef BB_FIND
104 {"find", find_main, _BB_DIR_USR_BIN, find_usage}, 114 APPLET("find", find_main, _BB_DIR_USR_BIN, find_usage)
105#endif 115#endif
106#ifdef BB_FREE 116#ifdef BB_FREE
107 {"free", free_main, _BB_DIR_USR_BIN, free_usage}, 117 APPLET("free", free_main, _BB_DIR_USR_BIN, free_usage)
108#endif 118#endif
109#ifdef BB_FREERAMDISK 119#ifdef BB_FREERAMDISK
110 {"freeramdisk", freeramdisk_main, _BB_DIR_SBIN, freeramdisk_usage}, 120 APPLET("freeramdisk", freeramdisk_main, _BB_DIR_SBIN, freeramdisk_usage)
111#endif 121#endif
112#ifdef BB_FSCK_MINIX 122#ifdef BB_FSCK_MINIX
113 {"fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage}, 123 APPLET("fsck.minix", fsck_minix_main, _BB_DIR_SBIN, fsck_minix_usage)
114#endif 124#endif
115#ifdef BB_GETOPT 125#ifdef BB_GETOPT
116 {"getopt", getopt_main, _BB_DIR_BIN, getopt_usage}, 126 APPLET("getopt", getopt_main, _BB_DIR_BIN, getopt_usage)
117#endif 127#endif
118#ifdef BB_GREP 128#ifdef BB_GREP
119 {"grep", grep_main, _BB_DIR_BIN, grep_usage}, 129 APPLET("grep", grep_main, _BB_DIR_BIN, grep_usage)
120#endif 130#endif
121#ifdef BB_GUNZIP 131#ifdef BB_GUNZIP
122 {"gunzip", gunzip_main, _BB_DIR_BIN, gunzip_usage}, 132 APPLET("gunzip", gunzip_main, _BB_DIR_BIN, gunzip_usage)
123#endif 133#endif
124#ifdef BB_GZIP 134#ifdef BB_GZIP
125 {"gzip", gzip_main, _BB_DIR_BIN, gzip_usage}, 135 APPLET("gzip", gzip_main, _BB_DIR_BIN, gzip_usage)
126#endif 136#endif
127#ifdef BB_HALT 137#ifdef BB_HALT
128 {"halt", halt_main, _BB_DIR_SBIN, halt_usage}, 138 APPLET("halt", halt_main, _BB_DIR_SBIN, halt_usage)
129#endif 139#endif
130#ifdef BB_HEAD 140#ifdef BB_HEAD
131 {"head", head_main, _BB_DIR_USR_BIN, head_usage}, 141 APPLET("head", head_main, _BB_DIR_USR_BIN, head_usage)
132#endif 142#endif
133#ifdef BB_HOSTID 143#ifdef BB_HOSTID
134 {"hostid", hostid_main, _BB_DIR_USR_BIN, hostid_usage}, 144 APPLET("hostid", hostid_main, _BB_DIR_USR_BIN, hostid_usage)
135#endif 145#endif
136#ifdef BB_HOSTNAME 146#ifdef BB_HOSTNAME
137 {"hostname", hostname_main, _BB_DIR_BIN, hostname_usage}, 147 APPLET("hostname", hostname_main, _BB_DIR_BIN, hostname_usage)
138#endif 148#endif
139#ifdef BB_ID 149#ifdef BB_ID
140 {"id", id_main, _BB_DIR_USR_BIN, id_usage}, 150 APPLET("id", id_main, _BB_DIR_USR_BIN, id_usage)
141#endif 151#endif
142#ifdef BB_INIT 152#ifdef BB_INIT
143 {"init", init_main, _BB_DIR_SBIN, NULL}, 153 APPLET_NOUSAGE("init", init_main, _BB_DIR_SBIN)
144#endif 154#endif
145#ifdef BB_INSMOD 155#ifdef BB_INSMOD
146 {"insmod", insmod_main, _BB_DIR_SBIN, insmod_usage}, 156 APPLET("insmod", insmod_main, _BB_DIR_SBIN, insmod_usage)
147#endif 157#endif
148#ifdef BB_KILL 158#ifdef BB_KILL
149 {"kill", kill_main, _BB_DIR_BIN, kill_usage}, 159 APPLET("kill", kill_main, _BB_DIR_BIN, kill_usage)
150#endif 160#endif
151#ifdef BB_KILLALL 161#ifdef BB_KILLALL
152 {"killall", kill_main, _BB_DIR_USR_BIN, kill_usage}, 162 APPLET("killall", kill_main, _BB_DIR_USR_BIN, killall_usage)
153#endif 163#endif
154#ifdef BB_LENGTH 164#ifdef BB_LENGTH
155 {"length", length_main, _BB_DIR_USR_BIN, length_usage}, 165 APPLET("length", length_main, _BB_DIR_USR_BIN, length_usage)
156#endif 166#endif
157#ifdef BB_LINUXRC 167#ifdef BB_LINUXRC
158 {"linuxrc", init_main, _BB_DIR_ROOT, NULL}, 168 APPLET_NOUSAGE("linuxrc", init_main, _BB_DIR_ROOT)
159#endif 169#endif
160#ifdef BB_LN 170#ifdef BB_LN
161 {"ln", ln_main, _BB_DIR_BIN, ln_usage}, 171 APPLET("ln", ln_main, _BB_DIR_BIN, ln_usage)
162#endif 172#endif
163#ifdef BB_LOADACM 173#ifdef BB_LOADACM
164 {"loadacm", loadacm_main, _BB_DIR_USR_BIN, loadacm_usage}, 174 APPLET("loadacm", loadacm_main, _BB_DIR_USR_BIN, loadacm_usage)
165#endif 175#endif
166#ifdef BB_LOADFONT 176#ifdef BB_LOADFONT
167 {"loadfont", loadfont_main, _BB_DIR_USR_BIN, loadfont_usage}, 177 APPLET("loadfont", loadfont_main, _BB_DIR_USR_BIN, loadfont_usage)
168#endif 178#endif
169#ifdef BB_LOADKMAP 179#ifdef BB_LOADKMAP
170 {"loadkmap", loadkmap_main, _BB_DIR_SBIN, loadkmap_usage}, 180 APPLET("loadkmap", loadkmap_main, _BB_DIR_SBIN, loadkmap_usage)
171#endif 181#endif
172#ifdef BB_LOGGER 182#ifdef BB_LOGGER
173 {"logger", logger_main, _BB_DIR_USR_BIN, logger_usage}, 183 APPLET("logger", logger_main, _BB_DIR_USR_BIN, logger_usage)
174#endif 184#endif
175#ifdef BB_LOGNAME 185#ifdef BB_LOGNAME
176 {"logname", logname_main, _BB_DIR_USR_BIN, logname_usage}, 186 APPLET("logname", logname_main, _BB_DIR_USR_BIN, logname_usage)
177#endif 187#endif
178#ifdef BB_LS 188#ifdef BB_LS
179 {"ls", ls_main, _BB_DIR_BIN, ls_usage}, 189 APPLET("ls", ls_main, _BB_DIR_BIN, ls_usage)
180#endif 190#endif
181#ifdef BB_LSMOD 191#ifdef BB_LSMOD
182 {"lsmod", lsmod_main, _BB_DIR_SBIN, lsmod_usage}, 192 APPLET("lsmod", lsmod_main, _BB_DIR_SBIN, lsmod_usage)
183#endif 193#endif
184#ifdef BB_MAKEDEVS 194#ifdef BB_MAKEDEVS
185 {"makedevs", makedevs_main, _BB_DIR_SBIN, makedevs_usage}, 195 APPLET("makedevs", makedevs_main, _BB_DIR_SBIN, makedevs_usage)
186#endif 196#endif
187#ifdef BB_MD5SUM 197#ifdef BB_MD5SUM
188 {"md5sum", md5sum_main, _BB_DIR_USR_BIN, md5sum_usage}, 198 APPLET("md5sum", md5sum_main, _BB_DIR_USR_BIN, md5sum_usage)
189#endif 199#endif
190#ifdef BB_MKDIR 200#ifdef BB_MKDIR
191 {"mkdir", mkdir_main, _BB_DIR_BIN, mkdir_usage}, 201 APPLET("mkdir", mkdir_main, _BB_DIR_BIN, mkdir_usage)
192#endif 202#endif
193#ifdef BB_MKFIFO 203#ifdef BB_MKFIFO
194 {"mkfifo", mkfifo_main, _BB_DIR_USR_BIN, mkfifo_usage}, 204 APPLET("mkfifo", mkfifo_main, _BB_DIR_USR_BIN, mkfifo_usage)
195#endif 205#endif
196#ifdef BB_MKFS_MINIX 206#ifdef BB_MKFS_MINIX
197 {"mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage}, 207 APPLET("mkfs.minix", mkfs_minix_main, _BB_DIR_SBIN, mkfs_minix_usage)
198#endif 208#endif
199#ifdef BB_MKNOD 209#ifdef BB_MKNOD
200 {"mknod", mknod_main, _BB_DIR_BIN, mknod_usage}, 210 APPLET("mknod", mknod_main, _BB_DIR_BIN, mknod_usage)
201#endif 211#endif
202#ifdef BB_MKSWAP 212#ifdef BB_MKSWAP
203 {"mkswap", mkswap_main, _BB_DIR_SBIN, mkswap_usage}, 213 APPLET("mkswap", mkswap_main, _BB_DIR_SBIN, mkswap_usage)
204#endif 214#endif
205#ifdef BB_MKTEMP 215#ifdef BB_MKTEMP
206 {"mktemp", mktemp_main, _BB_DIR_BIN, mktemp_usage}, 216 APPLET("mktemp", mktemp_main, _BB_DIR_BIN, mktemp_usage)
207#endif 217#endif
208#ifdef BB_MORE 218#ifdef BB_MORE
209 {"more", more_main, _BB_DIR_BIN, more_usage}, 219 APPLET("more", more_main, _BB_DIR_BIN, more_usage)
210#endif 220#endif
211#ifdef BB_MOUNT 221#ifdef BB_MOUNT
212 {"mount", mount_main, _BB_DIR_BIN, mount_usage}, 222 APPLET("mount", mount_main, _BB_DIR_BIN, mount_usage)
213#endif 223#endif
214#ifdef BB_MT 224#ifdef BB_MT
215 {"mt", mt_main, _BB_DIR_BIN, mt_usage}, 225 APPLET("mt", mt_main, _BB_DIR_BIN, mt_usage)
216#endif 226#endif
217#ifdef BB_CP_MV 227#ifdef BB_CP_MV
218 {"mv", cp_mv_main, _BB_DIR_BIN, mv_usage}, 228 APPLET("mv", cp_mv_main, _BB_DIR_BIN, mv_usage)
219#endif 229#endif
220#ifdef BB_NC 230#ifdef BB_NC
221 {"nc", nc_main, _BB_DIR_USR_BIN, nc_usage}, 231 APPLET("nc", nc_main, _BB_DIR_USR_BIN, nc_usage)
222#endif 232#endif
223#ifdef BB_NSLOOKUP 233#ifdef BB_NSLOOKUP
224 {"nslookup", nslookup_main, _BB_DIR_USR_BIN, nslookup_usage}, 234 APPLET("nslookup", nslookup_main, _BB_DIR_USR_BIN, nslookup_usage)
225#endif 235#endif
226#ifdef BB_PING 236#ifdef BB_PING
227 {"ping", ping_main, _BB_DIR_BIN, ping_usage}, 237 APPLET("ping", ping_main, _BB_DIR_BIN, ping_usage)
228#endif 238#endif
229#ifdef BB_POWEROFF 239#ifdef BB_POWEROFF
230 {"poweroff", poweroff_main, _BB_DIR_SBIN, poweroff_usage}, 240 APPLET("poweroff", poweroff_main, _BB_DIR_SBIN, poweroff_usage)
231#endif 241#endif
232#ifdef BB_PRINTF 242#ifdef BB_PRINTF
233 {"printf", printf_main, _BB_DIR_USR_BIN, printf_usage}, 243 APPLET("printf", printf_main, _BB_DIR_USR_BIN, printf_usage)
234#endif 244#endif
235#ifdef BB_PS 245#ifdef BB_PS
236 {"ps", ps_main, _BB_DIR_BIN, ps_usage}, 246 APPLET("ps", ps_main, _BB_DIR_BIN, ps_usage)
237#endif 247#endif
238#ifdef BB_PWD 248#ifdef BB_PWD
239 {"pwd", pwd_main, _BB_DIR_BIN, pwd_usage}, 249 APPLET("pwd", pwd_main, _BB_DIR_BIN, pwd_usage)
240#endif 250#endif
241#ifdef BB_RDATE 251#ifdef BB_RDATE
242 {"rdate", rdate_main, _BB_DIR_USR_BIN, rdate_usage}, 252 APPLET("rdate", rdate_main, _BB_DIR_USR_BIN, rdate_usage)
243#endif 253#endif
244#ifdef BB_READLINK 254#ifdef BB_READLINK
245 {"readlink", readlink_main, _BB_DIR_USR_BIN, readlink_usage}, 255 APPLET("readlink", readlink_main, _BB_DIR_USR_BIN, readlink_usage)
246#endif 256#endif
247#ifdef BB_REBOOT 257#ifdef BB_REBOOT
248 {"reboot", reboot_main, _BB_DIR_SBIN, reboot_usage}, 258 APPLET("reboot", reboot_main, _BB_DIR_SBIN, reboot_usage)
249#endif 259#endif
250#ifdef BB_RENICE 260#ifdef BB_RENICE
251 {"renice", renice_main, _BB_DIR_USR_BIN, renice_usage}, 261 APPLET("renice", renice_main, _BB_DIR_USR_BIN, renice_usage)
252#endif 262#endif
253#ifdef BB_RESET 263#ifdef BB_RESET
254 {"reset", reset_main, _BB_DIR_USR_BIN, reset_usage}, 264 APPLET("reset", reset_main, _BB_DIR_USR_BIN, reset_usage)
255#endif 265#endif
256#ifdef BB_RM 266#ifdef BB_RM
257 {"rm", rm_main, _BB_DIR_BIN, rm_usage}, 267 APPLET("rm", rm_main, _BB_DIR_BIN, rm_usage)
258#endif 268#endif
259#ifdef BB_RMDIR 269#ifdef BB_RMDIR
260 {"rmdir", rmdir_main, _BB_DIR_BIN, rmdir_usage}, 270 APPLET("rmdir", rmdir_main, _BB_DIR_BIN, rmdir_usage)
261#endif 271#endif
262#ifdef BB_RMMOD 272#ifdef BB_RMMOD
263 {"rmmod", rmmod_main, _BB_DIR_SBIN, rmmod_usage}, 273 APPLET("rmmod", rmmod_main, _BB_DIR_SBIN, rmmod_usage)
264#endif 274#endif
265#ifdef BB_RPMUNPACK 275#ifdef BB_RPMUNPACK
266 {"rpmunpack", rpmunpack_main, _BB_DIR_USR_BIN, rpmunpack_usage}, 276 APPLET("rpmunpack", rpmunpack_main, _BB_DIR_USR_BIN, rpmunpack_usage)
267#endif 277#endif
268#ifdef BB_SED 278#ifdef BB_SED
269 {"sed", sed_main, _BB_DIR_BIN, sed_usage}, 279 APPLET("sed", sed_main, _BB_DIR_BIN, sed_usage)
270#endif 280#endif
271#ifdef BB_SETKEYCODES 281#ifdef BB_SETKEYCODES
272 {"setkeycodes", setkeycodes_main, _BB_DIR_USR_BIN, setkeycodes_usage}, 282 APPLET("setkeycodes", setkeycodes_main, _BB_DIR_USR_BIN, setkeycodes_usage)
273#endif 283#endif
274#ifdef BB_SH 284#ifdef BB_SH
275 {"sh", shell_main, _BB_DIR_BIN, shell_usage}, 285 APPLET("sh", shell_main, _BB_DIR_BIN, shell_usage)
276#endif 286#endif
277#ifdef BB_SLEEP 287#ifdef BB_SLEEP
278 {"sleep", sleep_main, _BB_DIR_BIN, sleep_usage}, 288 APPLET("sleep", sleep_main, _BB_DIR_BIN, sleep_usage)
279#endif 289#endif
280#ifdef BB_SORT 290#ifdef BB_SORT
281 {"sort", sort_main, _BB_DIR_USR_BIN, sort_usage}, 291 APPLET("sort", sort_main, _BB_DIR_USR_BIN, sort_usage)
282#endif 292#endif
283#ifdef BB_SWAPONOFF 293#ifdef BB_SWAPONOFF
284 {"swapoff", swap_on_off_main, _BB_DIR_SBIN, swapoff_usage}, 294 APPLET("swapoff", swap_on_off_main, _BB_DIR_SBIN, swapoff_usage)
285#endif 295#endif
286#ifdef BB_SWAPONOFF 296#ifdef BB_SWAPONOFF
287 {"swapon", swap_on_off_main, _BB_DIR_SBIN, swapon_usage}, 297 APPLET("swapon", swap_on_off_main, _BB_DIR_SBIN, swapon_usage)
288#endif 298#endif
289#ifdef BB_SYNC 299#ifdef BB_SYNC
290 {"sync", sync_main, _BB_DIR_BIN, sync_usage}, 300 APPLET("sync", sync_main, _BB_DIR_BIN, sync_usage)
291#endif 301#endif
292#ifdef BB_SYSLOGD 302#ifdef BB_SYSLOGD
293 {"syslogd", syslogd_main, _BB_DIR_SBIN, syslogd_usage}, 303 APPLET("syslogd", syslogd_main, _BB_DIR_SBIN, syslogd_usage)
294#endif 304#endif
295#ifdef BB_TAIL 305#ifdef BB_TAIL
296 {"tail", tail_main, _BB_DIR_USR_BIN, tail_usage}, 306 APPLET("tail", tail_main, _BB_DIR_USR_BIN, tail_usage)
297#endif 307#endif
298#ifdef BB_TAR 308#ifdef BB_TAR
299 {"tar", tar_main, _BB_DIR_BIN, tar_usage}, 309 APPLET("tar", tar_main, _BB_DIR_BIN, tar_usage)
300#endif 310#endif
301#ifdef BB_TEE 311#ifdef BB_TEE
302 {"tee", tee_main, _BB_DIR_USR_BIN, tee_usage}, 312 APPLET("tee", tee_main, _BB_DIR_USR_BIN, tee_usage)
303#endif 313#endif
304#ifdef BB_TELNET 314#ifdef BB_TELNET
305 {"telnet", telnet_main, _BB_DIR_USR_BIN, telnet_usage}, 315 APPLET("telnet", telnet_main, _BB_DIR_USR_BIN, telnet_usage)
306#endif 316#endif
307#ifdef BB_TEST 317#ifdef BB_TEST
308 {"test", test_main, _BB_DIR_USR_BIN, test_usage}, 318 APPLET("test", test_main, _BB_DIR_USR_BIN, test_usage)
309#endif 319#endif
310#ifdef BB_TOUCH 320#ifdef BB_TOUCH
311 {"touch", touch_main, _BB_DIR_BIN, touch_usage}, 321 APPLET("touch", touch_main, _BB_DIR_BIN, touch_usage)
312#endif 322#endif
313#ifdef BB_TR 323#ifdef BB_TR
314 {"tr", tr_main, _BB_DIR_USR_BIN, tr_usage}, 324 APPLET("tr", tr_main, _BB_DIR_USR_BIN, tr_usage)
315#endif 325#endif
316#ifdef BB_TRUE_FALSE 326#ifdef BB_TRUE_FALSE
317 {"true", true_main, _BB_DIR_BIN, true_usage}, 327 APPLET("true", true_main, _BB_DIR_BIN, true_usage)
318#endif 328#endif
319#ifdef BB_TTY 329#ifdef BB_TTY
320 {"tty", tty_main, _BB_DIR_USR_BIN, tty_usage}, 330 APPLET("tty", tty_main, _BB_DIR_USR_BIN, tty_usage)
321#endif 331#endif
322#ifdef BB_UMOUNT 332#ifdef BB_UMOUNT
323 {"umount", umount_main, _BB_DIR_BIN, umount_usage}, 333 APPLET("umount", umount_main, _BB_DIR_BIN, umount_usage)
324#endif 334#endif
325#ifdef BB_UNAME 335#ifdef BB_UNAME
326 {"uname", uname_main, _BB_DIR_BIN, uname_usage}, 336 APPLET("uname", uname_main, _BB_DIR_BIN, uname_usage)
327#endif 337#endif
328#ifdef BB_UNIQ 338#ifdef BB_UNIQ
329 {"uniq", uniq_main, _BB_DIR_USR_BIN, uniq_usage}, 339 APPLET("uniq", uniq_main, _BB_DIR_USR_BIN, uniq_usage)
330#endif 340#endif
331#ifdef BB_UNIX2DOS 341#ifdef BB_UNIX2DOS
332 {"unix2dos", unix2dos_main, _BB_DIR_USR_BIN, unix2dos_usage}, 342 APPLET("unix2dos", unix2dos_main, _BB_DIR_USR_BIN, unix2dos_usage)
333#endif 343#endif
334#ifdef BB_UPDATE 344#ifdef BB_UPDATE
335 {"update", update_main, _BB_DIR_SBIN, update_usage}, 345 APPLET("update", update_main, _BB_DIR_SBIN, update_usage)
336#endif 346#endif
337#ifdef BB_UPTIME 347#ifdef BB_UPTIME
338 {"uptime", uptime_main, _BB_DIR_USR_BIN, uptime_usage}, 348 APPLET("uptime", uptime_main, _BB_DIR_USR_BIN, uptime_usage)
339#endif 349#endif
340#ifdef BB_USLEEP 350#ifdef BB_USLEEP
341 {"usleep", usleep_main, _BB_DIR_BIN, usleep_usage}, 351 APPLET("usleep", usleep_main, _BB_DIR_BIN, usleep_usage)
342#endif 352#endif
343#ifdef BB_UUDECODE 353#ifdef BB_UUDECODE
344 {"uudecode", uudecode_main, _BB_DIR_USR_BIN, uudecode_usage}, 354 APPLET("uudecode", uudecode_main, _BB_DIR_USR_BIN, uudecode_usage)
345#endif 355#endif
346#ifdef BB_UUENCODE 356#ifdef BB_UUENCODE
347 {"uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage}, 357 APPLET("uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage)
348#endif 358#endif
349#ifdef BB_WC 359#ifdef BB_WC
350 {"wc", wc_main, _BB_DIR_USR_BIN, wc_usage}, 360 APPLET("wc", wc_main, _BB_DIR_USR_BIN, wc_usage)
351#endif 361#endif
352#ifdef BB_WGET 362#ifdef BB_WGET
353 {"wget", wget_main, _BB_DIR_USR_BIN, wget_usage}, 363 APPLET("wget", wget_main, _BB_DIR_USR_BIN, wget_usage)
354#endif 364#endif
355#ifdef BB_WHICH 365#ifdef BB_WHICH
356 {"which", which_main, _BB_DIR_USR_BIN, which_usage}, 366 APPLET("which", which_main, _BB_DIR_USR_BIN, which_usage)
357#endif 367#endif
358#ifdef BB_WHOAMI 368#ifdef BB_WHOAMI
359 {"whoami", whoami_main, _BB_DIR_USR_BIN, whoami_usage}, 369 APPLET("whoami", whoami_main, _BB_DIR_USR_BIN, whoami_usage)
360#endif 370#endif
361#ifdef BB_XARGS 371#ifdef BB_XARGS
362 {"xargs", xargs_main, _BB_DIR_USR_BIN, xargs_usage}, 372 APPLET("xargs", xargs_main, _BB_DIR_USR_BIN, xargs_usage)
363#endif 373#endif
364#ifdef BB_YES 374#ifdef BB_YES
365 {"yes", yes_main, _BB_DIR_USR_BIN, yes_usage}, 375 APPLET("yes", yes_main, _BB_DIR_USR_BIN, yes_usage)
366#endif 376#endif
367#ifdef BB_GUNZIP 377#ifdef BB_GUNZIP
368 {"zcat", gunzip_main, _BB_DIR_BIN, gunzip_usage}, 378 APPLET("zcat", gunzip_main, _BB_DIR_BIN, gunzip_usage)
369#endif 379#endif
370 {0,NULL,0,NULL} 380
381#ifndef PROTOTYPES
382 { 0,NULL,0,NULL}
371}; 383};
372 384
373/* The -1 arises because of the {0,NULL,0,NULL} entry above. */ 385/* The -1 arises because of the {0,NULL,0,NULL} entry above. */
374size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1); 386size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
375 387
388#endif
diff --git a/include/busybox.h b/include/busybox.h
index 3fc91a387..cff4af41d 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -108,244 +108,19 @@ struct BB_applet {
108/* From busybox.c */ 108/* From busybox.c */
109extern const struct BB_applet applets[]; 109extern const struct BB_applet applets[];
110 110
111extern size_t NUM_APPLETS; 111/* Automagically pull in all the applet function prototypes and
112 112 * applet usage strings.
113 113 * These are all of the form:
114extern int applet_name_compare(const void *x, const void *y); 114 * extern int foo_main(int argc, char **argv);
115 115 * extern const char foo_usage[];
116extern int ar_main(int argc, char **argv); 116 * These are all autogenerated from the set of currently defined applets.
117extern int basename_main(int argc, char **argv); 117 */
118extern int bogomips_main(int argc, char **argv); 118#define PROTOTYPES
119extern int busybox_main(int argc, char** argv); 119#include "applets.h"
120extern int cat_main(int argc, char** argv); 120#undef PROTOTYPES
121extern int chmod_chown_chgrp_main(int argc, char** argv);
122extern int chroot_main(int argc, char** argv);
123extern int chvt_main(int argc, char** argv);
124extern int clear_main(int argc, char** argv);
125extern int cmp_main(int argc, char** argv);
126extern int cp_mv_main(int argc, char** argv);
127extern int cut_main(int argc, char** argv);
128extern int date_main(int argc, char** argv);
129extern int dc_main(int argc, char** argv);
130extern int dd_main(int argc, char** argv);
131extern int dirname_main(int argc, char** argv);
132extern int deallocvt_main(int argc, char** argv);
133extern int df_main(int argc, char** argv);
134extern int dmesg_main(int argc, char** argv);
135extern int dos2unix_main(int argc, char** argv);
136extern int du_main(int argc, char** argv);
137extern int dumpkmap_main(int argc, char** argv);
138extern int dutmp_main(int argc, char** argv);
139extern int echo_main(int argc, char** argv);
140extern int expr_main(int argc, char** argv);
141extern int false_main(int argc, char** argv);
142extern int fbset_main(int argc, char** argv);
143extern int fdisk_main(int argc, char** argv);
144extern int fdflush_main(int argc, char **argv);
145extern int fsck_minix_main(int argc, char **argv);
146extern int find_main(int argc, char** argv);
147extern int free_main(int argc, char** argv);
148extern int freeramdisk_main(int argc, char** argv);
149extern int getopt_main(int argc, char** argv);
150extern int grep_main(int argc, char** argv);
151extern int gunzip_main (int argc, char** argv);
152extern int gzip_main(int argc, char** argv);
153extern int halt_main(int argc, char** argv);
154extern int head_main(int argc, char** argv);
155extern int hostid_main(int argc, char** argv);
156extern int hostname_main(int argc, char** argv);
157extern int id_main(int argc, char** argv);
158extern int init_main(int argc, char** argv);
159extern int insmod_main(int argc, char** argv);
160extern int kill_main(int argc, char** argv);
161extern int length_main(int argc, char** argv);
162extern int ln_main(int argc, char** argv);
163extern int loadacm_main(int argc, char** argv);
164extern int loadfont_main(int argc, char** argv);
165extern int loadkmap_main(int argc, char** argv);
166extern int losetup_main(int argc, char** argv);
167extern int logger_main(int argc, char **argv);
168extern int logname_main(int argc, char **argv);
169extern int ls_main(int argc, char** argv);
170extern int lsmod_main(int argc, char** argv);
171extern int makedevs_main(int argc, char** argv);
172extern int md5sum_main(int argc, char** argv);
173extern int mkdir_main(int argc, char** argv);
174extern int mkfifo_main(int argc, char **argv);
175extern int mkfs_minix_main(int argc, char **argv);
176extern int mknod_main(int argc, char** argv);
177extern int mkswap_main(int argc, char** argv);
178extern int mktemp_main(int argc, char **argv);
179extern int nc_main(int argc, char** argv);
180extern int more_main(int argc, char** argv);
181extern int mount_main(int argc, char** argv);
182extern int mt_main(int argc, char** argv);
183extern int nslookup_main(int argc, char **argv);
184extern int ping_main(int argc, char **argv);
185extern int poweroff_main(int argc, char **argv);
186extern int printf_main(int argc, char** argv);
187extern int ps_main(int argc, char** argv);
188extern int pwd_main(int argc, char** argv);
189extern int rdate_main(int argc, char** argv);
190extern int readlink_main(int argc, char** argv);
191extern int reboot_main(int argc, char** argv);
192extern int renice_main(int argc, char** argv);
193extern int reset_main(int argc, char** argv);
194extern int rm_main(int argc, char** argv);
195extern int rmdir_main(int argc, char **argv);
196extern int rmmod_main(int argc, char** argv);
197extern int rpmunpack_main(int argc, char** argv);
198extern int sed_main(int argc, char** argv);
199extern int sfdisk_main(int argc, char** argv);
200extern int setkeycodes_main(int argc, char** argv);
201extern int shell_main(int argc, char** argv);
202extern int sleep_main(int argc, char** argv);
203extern int sort_main(int argc, char** argv);
204extern int swap_on_off_main(int argc, char** argv);
205extern int sync_main(int argc, char** argv);
206extern int syslogd_main(int argc, char **argv);
207extern int tail_main(int argc, char** argv);
208extern int tar_main(int argc, char** argv);
209extern int tee_main(int argc, char** argv);
210extern int test_main(int argc, char** argv);
211extern int telnet_main(int argc, char** argv);
212extern int touch_main(int argc, char** argv);
213extern int tr_main(int argc, char** argv);
214extern int true_main(int argc, char** argv);
215extern int tput_main(int argc, char** argv);
216extern int tryopen_main(int argc, char** argv);
217extern int tty_main(int argc, char** argv);
218extern int umount_main(int argc, char** argv);
219extern int uname_main(int argc, char** argv);
220extern int uniq_main(int argc, char** argv);
221extern int unix2dos_main(int argc, char** argv);
222extern int update_main(int argc, char** argv);
223extern int uptime_main(int argc, char** argv);
224extern int usleep_main(int argc, char** argv);
225extern int uuencode_main(int argc, char** argv);
226extern int uudecode_main(int argc, char** argv);
227extern int wc_main(int argc, char** argv);
228extern int wget_main(int argc, char** argv);
229extern int which_main(int argc, char** argv);
230extern int whoami_main(int argc, char** argv);
231extern int xargs_main(int argc, char** argv);
232extern int yes_main(int argc, char** argv);
233
234extern const char ar_usage[];
235extern const char basename_usage[];
236extern const char cat_usage[];
237extern const char chgrp_usage[];
238extern const char chmod_usage[];
239extern const char chown_usage[];
240extern const char chroot_usage[];
241extern const char chvt_usage[];
242extern const char clear_usage[];
243extern const char cmp_usage[];
244extern const char cp_usage[];
245extern const char cut_usage[];
246extern const char date_usage[];
247extern const char dc_usage[];
248extern const char dd_usage[];
249extern const char deallocvt_usage[];
250extern const char df_usage[];
251extern const char dirname_usage[];
252extern const char dmesg_usage[];
253extern const char dos2unix_usage[];
254extern const char du_usage[];
255extern const char dumpkmap_usage[];
256extern const char dutmp_usage[];
257extern const char echo_usage[];
258extern const char expr_usage[];
259extern const char false_usage[];
260extern const char fdflush_usage[];
261extern const char find_usage[];
262extern const char free_usage[];
263extern const char freeramdisk_usage[];
264extern const char fsck_minix_usage[];
265extern const char getopt_usage[];
266extern const char grep_usage[];
267extern const char gunzip_usage[];
268extern const char gzip_usage[];
269extern const char halt_usage[];
270extern const char head_usage[];
271extern const char hostid_usage[];
272extern const char hostname_usage[];
273extern const char id_usage[];
274extern const char insmod_usage[];
275extern const char kill_usage[];
276extern const char killall_usage[];
277extern const char length_usage[];
278extern const char ln_usage[];
279extern const char loadacm_usage[];
280extern const char loadfont_usage[];
281extern const char loadkmap_usage[];
282extern const char logger_usage[];
283extern const char logname_usage[];
284extern const char ls_usage[];
285extern const char lsmod_usage[];
286extern const char makedevs_usage[];
287extern const char md5sum_usage[];
288extern const char mkdir_usage[];
289extern const char mkfifo_usage[];
290extern const char mkfs_minix_usage[];
291extern const char mknod_usage[];
292extern const char mkswap_usage[];
293extern const char mktemp_usage[];
294extern const char more_usage[];
295extern const char mount_usage[];
296extern const char mt_usage[];
297extern const char mv_usage[];
298extern const char nc_usage[];
299extern const char nslookup_usage[];
300extern const char ping_usage[];
301extern const char poweroff_usage[];
302extern const char printf_usage[];
303extern const char ps_usage[];
304extern const char pwd_usage[];
305extern const char rdate_usage[];
306extern const char readlink_usage[];
307extern const char reboot_usage[];
308extern const char renice_usage[];
309extern const char reset_usage[];
310extern const char rm_usage[];
311extern const char rmdir_usage[];
312extern const char rmmod_usage[];
313extern const char rpmunpack_usage[];
314extern const char sed_usage[];
315extern const char setkeycodes_usage[];
316extern const char shell_usage[];
317extern const char sleep_usage[];
318extern const char sort_usage[];
319extern const char swapoff_usage[];
320extern const char swapon_usage[];
321extern const char sync_usage[];
322extern const char syslogd_usage[];
323extern const char tail_usage[];
324extern const char tar_usage[];
325extern const char tee_usage[];
326extern const char telnet_usage[];
327extern const char test_usage[];
328extern const char touch_usage[];
329extern const char tr_usage[];
330extern const char true_usage[];
331extern const char tty_usage[];
332extern const char umount_usage[];
333extern const char uname_usage[];
334extern const char uniq_usage[];
335extern const char unix2dos_usage[];
336extern const char update_usage[];
337extern const char uptime_usage[];
338extern const char usleep_usage[];
339extern const char uudecode_usage[];
340extern const char uuencode_usage[];
341extern const char wc_usage[];
342extern const char wget_usage[];
343extern const char which_usage[];
344extern const char whoami_usage[];
345extern const char xargs_usage[];
346extern const char yes_usage[];
347 121
348extern const char *applet_name; 122extern const char *applet_name;
123extern int applet_name_compare(const void *x, const void *y);
349 124
350extern void usage(const char *usage) __attribute__ ((noreturn)); 125extern void usage(const char *usage) __attribute__ ((noreturn));
351extern void errorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 126extern void errorMsg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
diff --git a/lash.c b/lash.c
index 87d4fbfbd..eba60b3b7 100644
--- a/lash.c
+++ b/lash.c
@@ -52,6 +52,7 @@
52#define MAX_LINE 256 /* size of input buffer for `read' builtin */ 52#define MAX_LINE 256 /* size of input buffer for `read' builtin */
53#define MAX_READ 128 /* size of input buffer for `read' builtin */ 53#define MAX_READ 128 /* size of input buffer for `read' builtin */
54#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" 54#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
55extern size_t NUM_APPLETS;
55 56
56 57
57enum redirectionType { REDIRECT_INPUT, REDIRECT_OVERWRITE, 58enum redirectionType { REDIRECT_INPUT, REDIRECT_OVERWRITE,
diff --git a/sh.c b/sh.c
index 87d4fbfbd..eba60b3b7 100644
--- a/sh.c
+++ b/sh.c
@@ -52,6 +52,7 @@
52#define MAX_LINE 256 /* size of input buffer for `read' builtin */ 52#define MAX_LINE 256 /* size of input buffer for `read' builtin */
53#define MAX_READ 128 /* size of input buffer for `read' builtin */ 53#define MAX_READ 128 /* size of input buffer for `read' builtin */
54#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" 54#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
55extern size_t NUM_APPLETS;
55 56
56 57
57enum redirectionType { REDIRECT_INPUT, REDIRECT_OVERWRITE, 58enum redirectionType { REDIRECT_INPUT, REDIRECT_OVERWRITE,
diff --git a/shell/lash.c b/shell/lash.c
index 87d4fbfbd..eba60b3b7 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -52,6 +52,7 @@
52#define MAX_LINE 256 /* size of input buffer for `read' builtin */ 52#define MAX_LINE 256 /* size of input buffer for `read' builtin */
53#define MAX_READ 128 /* size of input buffer for `read' builtin */ 53#define MAX_READ 128 /* size of input buffer for `read' builtin */
54#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n" 54#define JOB_STATUS_FORMAT "[%d] %-22s %.40s\n"
55extern size_t NUM_APPLETS;
55 56
56 57
57enum redirectionType { REDIRECT_INPUT, REDIRECT_OVERWRITE, 58enum redirectionType { REDIRECT_INPUT, REDIRECT_OVERWRITE,