"Robert P. J. Day" | 63fc1a9 | 2006-07-02 19:47:05 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
Mark Whitley | 130005c | 2000-10-25 00:28:27 +0000 | [diff] [blame] | 2 | /* |
| 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 Whitley | 130005c | 2000-10-25 00:28:27 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 9 | /* |
| 10 | name - applet name as it is typed on command line |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 11 | help - applet name, converted to C (ether-wake: help = ether_wake) |
Denis Vlasenko | 1b4b2cb | 2007-04-09 21:30:53 +0000 | [diff] [blame] | 12 | main - corresponding <applet>_main to call (bzcat: main = bunzip2) |
| 13 | l - location to install link to: [/usr]/[s]bin |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 14 | s - suid type: |
Denys Vlasenko | b9f2d9f | 2011-01-18 13:58:01 +0100 | [diff] [blame] | 15 | BB_SUID_REQUIRE: will complain if busybox isn't suid |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 16 | and is run by non-root (applet_main() will not be called at all) |
Denys Vlasenko | b9f2d9f | 2011-01-18 13:58:01 +0100 | [diff] [blame] | 17 | 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 Vlasenko | 6100b51 | 2011-01-03 13:57:49 +0100 | [diff] [blame] | 20 | needs to be justified in comment) |
Denys Vlasenko | 3b5acaa | 2011-01-18 13:52:48 +0100 | [diff] [blame] | 21 | NB: please update FEATURE_SUID help text whenever you add/remove |
Denys Vlasenko | b9f2d9f | 2011-01-18 13:58:01 +0100 | [diff] [blame] | 22 | BB_SUID_REQUIRE or BB_SUID_MAYBE applet. |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 23 | */ |
| 24 | |
Eric Andersen | 868c057 | 2000-12-02 00:44:48 +0000 | [diff] [blame] | 25 | #if defined(PROTOTYPES) |
Denis Vlasenko | 9b49a5e | 2007-10-11 10:05:36 +0000 | [diff] [blame] | 26 | # define APPLET(name,l,s) int name##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 27 | # 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 Yorston | 3778898 | 2018-11-17 17:48:14 +0000 | [diff] [blame] | 30 | # define APPLET_SCRIPTED(name,main,l,s,help) |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 31 | |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 32 | #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 Yorston | 3778898 | 2018-11-17 17:48:14 +0000 | [diff] [blame] | 37 | # define APPLET_SCRIPTED(name,main,l,s,help) name scripted_main |
Denis Vlasenko | f545be0 | 2007-10-07 17:06:26 +0000 | [diff] [blame] | 38 | |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 39 | #elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE |
Denys Vlasenko | 0e5ba08 | 2010-06-05 23:11:07 +0200 | [diff] [blame] | 40 | # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage name##_full_usage) |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 41 | # 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 Yorston | 3778898 | 2018-11-17 17:48:14 +0000 | [diff] [blame] | 44 | # define APPLET_SCRIPTED(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage) |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 45 | |
| 46 | #elif defined(MAKE_USAGE) && !ENABLE_FEATURE_VERBOSE_USAGE |
Denys Vlasenko | 0e5ba08 | 2010-06-05 23:11:07 +0200 | [diff] [blame] | 47 | # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage) |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 48 | # 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 Yorston | 3778898 | 2018-11-17 17:48:14 +0000 | [diff] [blame] | 51 | # define APPLET_SCRIPTED(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage) |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 52 | |
Eric Andersen | 3574b70 | 2001-02-23 02:16:29 +0000 | [diff] [blame] | 53 | #elif defined(MAKE_LINKS) |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 54 | # define APPLET(name,l,c) LINK l name |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 55 | # 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 Yorston | 3778898 | 2018-11-17 17:48:14 +0000 | [diff] [blame] | 58 | # define APPLET_SCRIPTED(name,main,l,s,help) LINK l name |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 59 | |
Bernhard Reutner-Fischer | 9078633 | 2013-06-10 17:08:22 +0200 | [diff] [blame] | 60 | #elif defined(MAKE_SUID) |
| 61 | # define APPLET(name,l,s) SUID s l name |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 62 | # 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 Yorston | 3778898 | 2018-11-17 17:48:14 +0000 | [diff] [blame] | 65 | # 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-Fischer | 9078633 | 2013-06-10 17:08:22 +0200 | [diff] [blame] | 73 | |
Eric Andersen | 868c057 | 2000-12-02 00:44:48 +0000 | [diff] [blame] | 74 | #else |
Denis Vlasenko | 1aa7e47 | 2007-11-28 06:49:03 +0000 | [diff] [blame] | 75 | static struct bb_applet applets[] = { /* name, main, location, need_suid */ |
| 76 | # define APPLET(name,l,s) { #name, #name, l, s }, |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 77 | # 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 Yorston | 3778898 | 2018-11-17 17:48:14 +0000 | [diff] [blame] | 80 | # define APPLET_SCRIPTED(name,main,l,s,help) { #name, #main, l, s }, |
Eric Andersen | 8c725e6 | 2000-11-30 00:27:06 +0000 | [diff] [blame] | 81 | #endif |
Mark Whitley | 130005c | 2000-10-25 00:28:27 +0000 | [diff] [blame] | 82 | |
Joachim Nilsson | dc16003 | 2010-12-05 23:05:38 +0100 | [diff] [blame] | 83 | #if ENABLE_INSTALL_NO_USR |
Denys Vlasenko | b9f2d9f | 2011-01-18 13:58:01 +0100 | [diff] [blame] | 84 | # define BB_DIR_USR_BIN BB_DIR_BIN |
| 85 | # define BB_DIR_USR_SBIN BB_DIR_SBIN |
Joachim Nilsson | dc16003 | 2010-12-05 23:05:38 +0100 | [diff] [blame] | 86 | #endif |
| 87 | |
Denis Vlasenko | c44ab01 | 2007-04-09 03:11:58 +0000 | [diff] [blame] | 88 | |
Denys Vlasenko | 6c5bf0d | 2010-06-06 00:53:45 +0200 | [diff] [blame] | 89 | INSERT |
Denys Vlasenko | f7683cd | 2016-11-23 18:54:59 +0100 | [diff] [blame] | 90 | |
Eric Andersen | 8c725e6 | 2000-11-30 00:27:06 +0000 | [diff] [blame] | 91 | |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 92 | #if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \ |
Bernhard Reutner-Fischer | 9078633 | 2013-06-10 17:08:22 +0200 | [diff] [blame] | 93 | && !defined(MAKE_LINKS) && !defined(MAKE_SUID) |
Mark Whitley | 130005c | 2000-10-25 00:28:27 +0000 | [diff] [blame] | 94 | }; |
Eric Andersen | 8c725e6 | 2000-11-30 00:27:06 +0000 | [diff] [blame] | 95 | #endif |
Denis Vlasenko | 32b633a | 2007-04-09 03:05:48 +0000 | [diff] [blame] | 96 | |
| 97 | #undef APPLET |
Denis Vlasenko | 32b633a | 2007-04-09 03:05:48 +0000 | [diff] [blame] | 98 | #undef APPLET_ODDNAME |
Denis Vlasenko | c44ab01 | 2007-04-09 03:11:58 +0000 | [diff] [blame] | 99 | #undef APPLET_NOEXEC |
Denis Vlasenko | 1b4b2cb | 2007-04-09 21:30:53 +0000 | [diff] [blame] | 100 | #undef APPLET_NOFORK |
Ron Yorston | 3778898 | 2018-11-17 17:48:14 +0000 | [diff] [blame] | 101 | #undef APPLET_SCRIPTED |