blob: 2ddf120ad4b9eb55cbe234a2e35216418cef31e0 [file] [log] [blame]
"Robert P. J. Day"63fc1a92006-07-02 19:47:05 +00001/* vi: set sw=4 ts=4: */
Mark Whitley130005c2000-10-25 00:28:27 +00002/*
3 * applets.h - a listing of all busybox applets.
4 *
5 * If you write a new applet, you need to add an entry to this list to make
6 * busybox aware of it.
Mark Whitley130005c2000-10-25 00:28:27 +00007 */
8
Denis Vlasenko786834b2007-04-08 17:30:10 +00009/*
10name - applet name as it is typed on command line
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020011help - applet name, converted to C (ether-wake: help = ether_wake)
Denis Vlasenko1b4b2cb2007-04-09 21:30:53 +000012main - corresponding <applet>_main to call (bzcat: main = bunzip2)
13l - location to install link to: [/usr]/[s]bin
Denis Vlasenko786834b2007-04-08 17:30:10 +000014s - suid type:
Denys Vlasenkob9f2d9f2011-01-18 13:58:01 +010015 BB_SUID_REQUIRE: will complain if busybox isn't suid
Denis Vlasenko786834b2007-04-08 17:30:10 +000016 and is run by non-root (applet_main() will not be called at all)
Denys Vlasenkob9f2d9f2011-01-18 13:58:01 +010017 BB_SUID_DROP: will drop suid prior to applet_main()
18 BB_SUID_MAYBE: neither of the above
19 (every instance of BB_SUID_REQUIRE and BB_SUID_MAYBE
Denys Vlasenko6100b512011-01-03 13:57:49 +010020 needs to be justified in comment)
Denys Vlasenko3b5acaa2011-01-18 13:52:48 +010021 NB: please update FEATURE_SUID help text whenever you add/remove
Denys Vlasenkob9f2d9f2011-01-18 13:58:01 +010022 BB_SUID_REQUIRE or BB_SUID_MAYBE applet.
Denis Vlasenko786834b2007-04-08 17:30:10 +000023*/
24
Eric Andersen868c0572000-12-02 00:44:48 +000025#if defined(PROTOTYPES)
Denis Vlasenko9b49a5e2007-10-11 10:05:36 +000026# define APPLET(name,l,s) int name##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020027# define APPLET_ODDNAME(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
28# define APPLET_NOEXEC(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
29# define APPLET_NOFORK(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
Denis Vlasenko786834b2007-04-08 17:30:10 +000030
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020031#elif defined(NAME_MAIN)
32# define APPLET(name,l,s) name name##_main
33# define APPLET_ODDNAME(name,main,l,s,help) name main##_main
34# define APPLET_NOEXEC(name,main,l,s,help) name main##_main
35# define APPLET_NOFORK(name,main,l,s,help) name main##_main
Denis Vlasenkof545be02007-10-07 17:06:26 +000036
Denis Vlasenko786834b2007-04-08 17:30:10 +000037#elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE
Denys Vlasenko0e5ba082010-06-05 23:11:07 +020038# define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage name##_full_usage)
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020039# define APPLET_ODDNAME(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
40# define APPLET_NOEXEC(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
41# define APPLET_NOFORK(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
Denis Vlasenko786834b2007-04-08 17:30:10 +000042
43#elif defined(MAKE_USAGE) && !ENABLE_FEATURE_VERBOSE_USAGE
Denys Vlasenko0e5ba082010-06-05 23:11:07 +020044# define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage)
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020045# define APPLET_ODDNAME(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
46# define APPLET_NOEXEC(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
47# define APPLET_NOFORK(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
Denis Vlasenko786834b2007-04-08 17:30:10 +000048
Eric Andersen3574b702001-02-23 02:16:29 +000049#elif defined(MAKE_LINKS)
Denis Vlasenko786834b2007-04-08 17:30:10 +000050# define APPLET(name,l,c) LINK l name
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020051# define APPLET_ODDNAME(name,main,l,s,help) LINK l name
52# define APPLET_NOEXEC(name,main,l,s,help) LINK l name
53# define APPLET_NOFORK(name,main,l,s,help) LINK l name
Denis Vlasenko786834b2007-04-08 17:30:10 +000054
Bernhard Reutner-Fischer90786332013-06-10 17:08:22 +020055#elif defined(MAKE_SUID)
56# define APPLET(name,l,s) SUID s l name
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020057# define APPLET_ODDNAME(name,main,l,s,help) SUID s l name
58# define APPLET_NOEXEC(name,main,l,s,help) SUID s l name
59# define APPLET_NOFORK(name,main,l,s,help) SUID s l name
Bernhard Reutner-Fischer90786332013-06-10 17:08:22 +020060
Eric Andersen868c0572000-12-02 00:44:48 +000061#else
Denis Vlasenko1aa7e472007-11-28 06:49:03 +000062 static struct bb_applet applets[] = { /* name, main, location, need_suid */
63# define APPLET(name,l,s) { #name, #name, l, s },
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020064# define APPLET_ODDNAME(name,main,l,s,help) { #name, #main, l, s },
65# define APPLET_NOEXEC(name,main,l,s,help) { #name, #main, l, s, 1 },
66# define APPLET_NOFORK(name,main,l,s,help) { #name, #main, l, s, 1, 1 },
Eric Andersen8c725e62000-11-30 00:27:06 +000067#endif
Mark Whitley130005c2000-10-25 00:28:27 +000068
Joachim Nilssondc160032010-12-05 23:05:38 +010069#if ENABLE_INSTALL_NO_USR
Denys Vlasenkob9f2d9f2011-01-18 13:58:01 +010070# define BB_DIR_USR_BIN BB_DIR_BIN
71# define BB_DIR_USR_SBIN BB_DIR_SBIN
Joachim Nilssondc160032010-12-05 23:05:38 +010072#endif
73
Denis Vlasenkoc44ab012007-04-09 03:11:58 +000074
Denys Vlasenko6c5bf0d2010-06-06 00:53:45 +020075INSERT
Denys Vlasenkof7683cd2016-11-23 18:54:59 +010076
Eric Andersen8c725e62000-11-30 00:27:06 +000077
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020078#if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \
Bernhard Reutner-Fischer90786332013-06-10 17:08:22 +020079 && !defined(MAKE_LINKS) && !defined(MAKE_SUID)
Mark Whitley130005c2000-10-25 00:28:27 +000080};
Eric Andersen8c725e62000-11-30 00:27:06 +000081#endif
Denis Vlasenko32b633a2007-04-09 03:05:48 +000082
83#undef APPLET
Denis Vlasenko32b633a2007-04-09 03:05:48 +000084#undef APPLET_ODDNAME
Denis Vlasenkoc44ab012007-04-09 03:11:58 +000085#undef APPLET_NOEXEC
Denis Vlasenko1b4b2cb2007-04-09 21:30:53 +000086#undef APPLET_NOFORK