"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; |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 30 | |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 31 | #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 Vlasenko | f545be0 | 2007-10-07 17:06:26 +0000 | [diff] [blame] | 36 | |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 37 | #elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE |
Denys Vlasenko | 0e5ba08 | 2010-06-05 23:11:07 +0200 | [diff] [blame] | 38 | # 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] | 39 | # 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 Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 42 | |
| 43 | #elif defined(MAKE_USAGE) && !ENABLE_FEATURE_VERBOSE_USAGE |
Denys Vlasenko | 0e5ba08 | 2010-06-05 23:11:07 +0200 | [diff] [blame] | 44 | # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage) |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 45 | # 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 Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 48 | |
Eric Andersen | 3574b70 | 2001-02-23 02:16:29 +0000 | [diff] [blame] | 49 | #elif defined(MAKE_LINKS) |
Denis Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 50 | # define APPLET(name,l,c) LINK l name |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 51 | # 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 Vlasenko | 786834b | 2007-04-08 17:30:10 +0000 | [diff] [blame] | 54 | |
Bernhard Reutner-Fischer | 9078633 | 2013-06-10 17:08:22 +0200 | [diff] [blame] | 55 | #elif defined(MAKE_SUID) |
| 56 | # define APPLET(name,l,s) SUID s l name |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 57 | # 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-Fischer | 9078633 | 2013-06-10 17:08:22 +0200 | [diff] [blame] | 60 | |
Eric Andersen | 868c057 | 2000-12-02 00:44:48 +0000 | [diff] [blame] | 61 | #else |
Denis Vlasenko | 1aa7e47 | 2007-11-28 06:49:03 +0000 | [diff] [blame] | 62 | static struct bb_applet applets[] = { /* name, main, location, need_suid */ |
| 63 | # define APPLET(name,l,s) { #name, #name, l, s }, |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 64 | # 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 Andersen | 8c725e6 | 2000-11-30 00:27:06 +0000 | [diff] [blame] | 67 | #endif |
Mark Whitley | 130005c | 2000-10-25 00:28:27 +0000 | [diff] [blame] | 68 | |
Joachim Nilsson | dc16003 | 2010-12-05 23:05:38 +0100 | [diff] [blame] | 69 | #if ENABLE_INSTALL_NO_USR |
Denys Vlasenko | b9f2d9f | 2011-01-18 13:58:01 +0100 | [diff] [blame] | 70 | # define BB_DIR_USR_BIN BB_DIR_BIN |
| 71 | # define BB_DIR_USR_SBIN BB_DIR_SBIN |
Joachim Nilsson | dc16003 | 2010-12-05 23:05:38 +0100 | [diff] [blame] | 72 | #endif |
| 73 | |
Denis Vlasenko | c44ab01 | 2007-04-09 03:11:58 +0000 | [diff] [blame] | 74 | |
Denys Vlasenko | 6c5bf0d | 2010-06-06 00:53:45 +0200 | [diff] [blame] | 75 | INSERT |
Denys Vlasenko | f7683cd | 2016-11-23 18:54:59 +0100 | [diff] [blame] | 76 | |
Eric Andersen | 8c725e6 | 2000-11-30 00:27:06 +0000 | [diff] [blame] | 77 | |
Denys Vlasenko | 5fd3ddf | 2014-04-19 15:04:39 +0200 | [diff] [blame] | 78 | #if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \ |
Bernhard Reutner-Fischer | 9078633 | 2013-06-10 17:08:22 +0200 | [diff] [blame] | 79 | && !defined(MAKE_LINKS) && !defined(MAKE_SUID) |
Mark Whitley | 130005c | 2000-10-25 00:28:27 +0000 | [diff] [blame] | 80 | }; |
Eric Andersen | 8c725e6 | 2000-11-30 00:27:06 +0000 | [diff] [blame] | 81 | #endif |
Denis Vlasenko | 32b633a | 2007-04-09 03:05:48 +0000 | [diff] [blame] | 82 | |
| 83 | #undef APPLET |
Denis Vlasenko | 32b633a | 2007-04-09 03:05:48 +0000 | [diff] [blame] | 84 | #undef APPLET_ODDNAME |
Denis Vlasenko | c44ab01 | 2007-04-09 03:11:58 +0000 | [diff] [blame] | 85 | #undef APPLET_NOEXEC |
Denis Vlasenko | 1b4b2cb | 2007-04-09 21:30:53 +0000 | [diff] [blame] | 86 | #undef APPLET_NOFORK |