blob: 60968cec76680760bd29b539524940b8da8d582b [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;
Ron Yorston37788982018-11-17 17:48:14 +000030# define APPLET_SCRIPTED(name,main,l,s,help)
Denis Vlasenko786834b2007-04-08 17:30:10 +000031
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020032#elif defined(NAME_MAIN)
33# define APPLET(name,l,s) name name##_main
34# define APPLET_ODDNAME(name,main,l,s,help) name main##_main
35# define APPLET_NOEXEC(name,main,l,s,help) name main##_main
36# define APPLET_NOFORK(name,main,l,s,help) name main##_main
Ron Yorston37788982018-11-17 17:48:14 +000037# define APPLET_SCRIPTED(name,main,l,s,help) name scripted_main
Denis Vlasenkof545be02007-10-07 17:06:26 +000038
Denis Vlasenko786834b2007-04-08 17:30:10 +000039#elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE
Denys Vlasenko0e5ba082010-06-05 23:11:07 +020040# define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage name##_full_usage)
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020041# define APPLET_ODDNAME(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
42# define APPLET_NOEXEC(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
43# define APPLET_NOFORK(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
Ron Yorston37788982018-11-17 17:48:14 +000044# define APPLET_SCRIPTED(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
Denis Vlasenko786834b2007-04-08 17:30:10 +000045
46#elif defined(MAKE_USAGE) && !ENABLE_FEATURE_VERBOSE_USAGE
Denys Vlasenko0e5ba082010-06-05 23:11:07 +020047# define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage)
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020048# define APPLET_ODDNAME(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
49# define APPLET_NOEXEC(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
50# define APPLET_NOFORK(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
Ron Yorston37788982018-11-17 17:48:14 +000051# define APPLET_SCRIPTED(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
Denis Vlasenko786834b2007-04-08 17:30:10 +000052
Eric Andersen3574b702001-02-23 02:16:29 +000053#elif defined(MAKE_LINKS)
Denis Vlasenko786834b2007-04-08 17:30:10 +000054# define APPLET(name,l,c) LINK l name
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020055# define APPLET_ODDNAME(name,main,l,s,help) LINK l name
56# define APPLET_NOEXEC(name,main,l,s,help) LINK l name
57# define APPLET_NOFORK(name,main,l,s,help) LINK l name
Ron Yorston37788982018-11-17 17:48:14 +000058# define APPLET_SCRIPTED(name,main,l,s,help) LINK l name
Denis Vlasenko786834b2007-04-08 17:30:10 +000059
Bernhard Reutner-Fischer90786332013-06-10 17:08:22 +020060#elif defined(MAKE_SUID)
61# define APPLET(name,l,s) SUID s l name
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020062# define APPLET_ODDNAME(name,main,l,s,help) SUID s l name
63# define APPLET_NOEXEC(name,main,l,s,help) SUID s l name
64# define APPLET_NOFORK(name,main,l,s,help) SUID s l name
Ron Yorston37788982018-11-17 17:48:14 +000065# define APPLET_SCRIPTED(name,main,l,s,help) SUID s l name
66
67#elif defined(MAKE_SCRIPTS)
68# define APPLET(name,l,s)
69# define APPLET_ODDNAME(name,main,l,s,help)
70# define APPLET_NOEXEC(name,main,l,s,help)
71# define APPLET_NOFORK(name,main,l,s,help)
72# define APPLET_SCRIPTED(name,main,l,s,help) SCRIPT name
Bernhard Reutner-Fischer90786332013-06-10 17:08:22 +020073
Eric Andersen868c0572000-12-02 00:44:48 +000074#else
Denis Vlasenko1aa7e472007-11-28 06:49:03 +000075 static struct bb_applet applets[] = { /* name, main, location, need_suid */
76# define APPLET(name,l,s) { #name, #name, l, s },
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020077# define APPLET_ODDNAME(name,main,l,s,help) { #name, #main, l, s },
78# define APPLET_NOEXEC(name,main,l,s,help) { #name, #main, l, s, 1 },
79# define APPLET_NOFORK(name,main,l,s,help) { #name, #main, l, s, 1, 1 },
Ron Yorston37788982018-11-17 17:48:14 +000080# define APPLET_SCRIPTED(name,main,l,s,help) { #name, #main, l, s },
Eric Andersen8c725e62000-11-30 00:27:06 +000081#endif
Mark Whitley130005c2000-10-25 00:28:27 +000082
Joachim Nilssondc160032010-12-05 23:05:38 +010083#if ENABLE_INSTALL_NO_USR
Denys Vlasenkob9f2d9f2011-01-18 13:58:01 +010084# define BB_DIR_USR_BIN BB_DIR_BIN
85# define BB_DIR_USR_SBIN BB_DIR_SBIN
Joachim Nilssondc160032010-12-05 23:05:38 +010086#endif
87
Denis Vlasenkoc44ab012007-04-09 03:11:58 +000088
Denys Vlasenko6c5bf0d2010-06-06 00:53:45 +020089INSERT
Denys Vlasenkof7683cd2016-11-23 18:54:59 +010090
Eric Andersen8c725e62000-11-30 00:27:06 +000091
Denys Vlasenko5fd3ddf2014-04-19 15:04:39 +020092#if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \
Bernhard Reutner-Fischer90786332013-06-10 17:08:22 +020093 && !defined(MAKE_LINKS) && !defined(MAKE_SUID)
Mark Whitley130005c2000-10-25 00:28:27 +000094};
Eric Andersen8c725e62000-11-30 00:27:06 +000095#endif
Denis Vlasenko32b633a2007-04-09 03:05:48 +000096
97#undef APPLET
Denis Vlasenko32b633a2007-04-09 03:05:48 +000098#undef APPLET_ODDNAME
Denis Vlasenkoc44ab012007-04-09 03:11:58 +000099#undef APPLET_NOEXEC
Denis Vlasenko1b4b2cb2007-04-09 21:30:53 +0000100#undef APPLET_NOFORK
Ron Yorston37788982018-11-17 17:48:14 +0000101#undef APPLET_SCRIPTED