applets.src.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. # define APPLET_SCRIPTED(name,main,l,s,help)
  29. #elif defined(NAME_MAIN)
  30. # define APPLET(name,l,s) name name##_main
  31. # define APPLET_ODDNAME(name,main,l,s,help) name main##_main
  32. # define APPLET_NOEXEC(name,main,l,s,help) name main##_main
  33. # define APPLET_NOFORK(name,main,l,s,help) name main##_main
  34. # define APPLET_SCRIPTED(name,main,l,s,help) name scripted_main
  35. #elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE
  36. # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage name##_full_usage)
  37. # define APPLET_ODDNAME(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
  38. # define APPLET_NOEXEC(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
  39. # define APPLET_NOFORK(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
  40. # define APPLET_SCRIPTED(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage help##_full_usage)
  41. #elif defined(MAKE_USAGE) && !ENABLE_FEATURE_VERBOSE_USAGE
  42. # define APPLET(name,l,s) MAKE_USAGE(#name, name##_trivial_usage)
  43. # define APPLET_ODDNAME(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
  44. # define APPLET_NOEXEC(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
  45. # define APPLET_NOFORK(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
  46. # define APPLET_SCRIPTED(name,main,l,s,help) MAKE_USAGE(#name, help##_trivial_usage)
  47. #elif defined(MAKE_LINKS)
  48. # define APPLET(name,l,c) LINK l name
  49. # define APPLET_ODDNAME(name,main,l,s,help) LINK l name
  50. # define APPLET_NOEXEC(name,main,l,s,help) LINK l name
  51. # define APPLET_NOFORK(name,main,l,s,help) LINK l name
  52. # define APPLET_SCRIPTED(name,main,l,s,help) LINK l name
  53. #elif defined(MAKE_SUID)
  54. # define APPLET(name,l,s) SUID s l name
  55. # define APPLET_ODDNAME(name,main,l,s,help) SUID s l name
  56. # define APPLET_NOEXEC(name,main,l,s,help) SUID s l name
  57. # define APPLET_NOFORK(name,main,l,s,help) SUID s l name
  58. # define APPLET_SCRIPTED(name,main,l,s,help) SUID s l name
  59. #elif defined(MAKE_SCRIPTS)
  60. # define APPLET(name,l,s)
  61. # define APPLET_ODDNAME(name,main,l,s,help)
  62. # define APPLET_NOEXEC(name,main,l,s,help)
  63. # define APPLET_NOFORK(name,main,l,s,help)
  64. # define APPLET_SCRIPTED(name,main,l,s,help) SCRIPT name
  65. #else
  66. static struct bb_applet applets[] = { /* name, main, location, need_suid */
  67. # define APPLET(name,l,s) { #name, #name, l, s },
  68. # define APPLET_ODDNAME(name,main,l,s,help) { #name, #main, l, s },
  69. # define APPLET_NOEXEC(name,main,l,s,help) { #name, #main, l, s, 1 },
  70. # define APPLET_NOFORK(name,main,l,s,help) { #name, #main, l, s, 1, 1 },
  71. # define APPLET_SCRIPTED(name,main,l,s,help) { #name, #main, l, s },
  72. #endif
  73. #if ENABLE_INSTALL_NO_USR
  74. # define BB_DIR_USR_BIN BB_DIR_BIN
  75. # define BB_DIR_USR_SBIN BB_DIR_SBIN
  76. #endif
  77. INSERT
  78. #if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \
  79. && !defined(MAKE_LINKS) && !defined(MAKE_SUID)
  80. };
  81. #endif
  82. #undef APPLET
  83. #undef APPLET_ODDNAME
  84. #undef APPLET_NOEXEC
  85. #undef APPLET_NOFORK
  86. #undef APPLET_SCRIPTED