applets.src.h 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* vi: set sw=4 ts=4: */
  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.
  7. */
  8. /*
  9. name - applet name as it is typed on command line
  10. help - applet name, converted to C (ether-wake: help = ether_wake)
  11. main - corresponding <applet>_main to call (bzcat: main = bunzip2)
  12. l - location to install link to: [/usr]/[s]bin
  13. s - suid type:
  14. BB_SUID_REQUIRE: will complain if busybox isn't suid
  15. and is run by non-root (applet_main() will not be called at all)
  16. BB_SUID_DROP: will drop suid prior to applet_main()
  17. BB_SUID_MAYBE: neither of the above
  18. (every instance of BB_SUID_REQUIRE and BB_SUID_MAYBE
  19. needs to be justified in comment)
  20. NB: please update FEATURE_SUID help text whenever you add/remove
  21. BB_SUID_REQUIRE or BB_SUID_MAYBE applet.
  22. */
  23. #if defined(PROTOTYPES)
  24. # define APPLET(name,l,s) int name##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  25. # define APPLET_ODDNAME(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  26. # define APPLET_NOEXEC(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  27. # define APPLET_NOFORK(name,main,l,s,help) int main##_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
  28. #elif defined(NAME_MAIN)
  29. # define APPLET(name,l,s) name name##_main
  30. # define APPLET_ODDNAME(name,main,l,s,help) name main##_main
  31. # define APPLET_NOEXEC(name,main,l,s,help) name main##_main
  32. # define APPLET_NOFORK(name,main,l,s,help) name main##_main
  33. #elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE
  34. # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage name##_full_usage)
  35. # define APPLET_ODDNAME(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
  36. # define APPLET_NOEXEC(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
  37. # define APPLET_NOFORK(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
  38. #elif defined(MAKE_USAGE) && !ENABLE_FEATURE_VERBOSE_USAGE
  39. # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage)
  40. # define APPLET_ODDNAME(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
  41. # define APPLET_NOEXEC(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
  42. # define APPLET_NOFORK(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
  43. #elif defined(MAKE_LINKS)
  44. # define APPLET(name,l,c) LINK l name
  45. # define APPLET_ODDNAME(name,main,l,s,help) LINK l name
  46. # define APPLET_NOEXEC(name,main,l,s,help) LINK l name
  47. # define APPLET_NOFORK(name,main,l,s,help) LINK l name
  48. #elif defined(MAKE_SUID)
  49. # define APPLET(name,l,s) SUID s l name
  50. # define APPLET_ODDNAME(name,main,l,s,help) SUID s l name
  51. # define APPLET_NOEXEC(name,main,l,s,help) SUID s l name
  52. # define APPLET_NOFORK(name,main,l,s,help) SUID s l name
  53. #else
  54. static struct bb_applet applets[] = { /* name, main, location, need_suid */
  55. # define APPLET(name,l,s) { #name, #name, l, s },
  56. # define APPLET_ODDNAME(name,main,l,s,help) { #name, #main, l, s },
  57. # define APPLET_NOEXEC(name,main,l,s,help) { #name, #main, l, s, 1 },
  58. # define APPLET_NOFORK(name,main,l,s,help) { #name, #main, l, s, 1, 1 },
  59. #endif
  60. #if ENABLE_INSTALL_NO_USR
  61. # define BB_DIR_USR_BIN BB_DIR_BIN
  62. # define BB_DIR_USR_SBIN BB_DIR_SBIN
  63. #endif
  64. INSERT
  65. #if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \
  66. && !defined(MAKE_LINKS) && !defined(MAKE_SUID)
  67. };
  68. #endif
  69. #undef APPLET
  70. #undef APPLET_ODDNAME
  71. #undef APPLET_NOEXEC
  72. #undef APPLET_NOFORK