make --help work for "individual applets" too.
[platform/upstream/busybox.git] / include / busybox.h
1 /* vi: set sw=4 ts=4: */
2 /*
3  * Busybox main internal header file
4  *
5  * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
6  */
7 #ifndef _BB_INTERNAL_H_
8 #define _BB_INTERNAL_H_    1
9
10 #include "libbb.h"
11
12 #if ENABLE_FEATURE_INSTALLER
13 /* order matters: used as index into "install_dir[]" in busybox.c */
14 typedef enum bb_install_loc_t {
15         _BB_DIR_ROOT = 0,
16         _BB_DIR_BIN,
17         _BB_DIR_SBIN,
18         _BB_DIR_USR_BIN,
19         _BB_DIR_USR_SBIN
20 } bb_install_loc_t;
21 #endif
22
23 #if ENABLE_FEATURE_SUID
24 typedef enum bb_suid_t {
25         _BB_SUID_NEVER = 0,
26         _BB_SUID_MAYBE,
27         _BB_SUID_ALWAYS
28 } bb_suid_t;
29 #endif
30
31 struct bb_applet {
32         const char *name;
33         int (*main) (int argc, char **argv);
34 #if ENABLE_FEATURE_INSTALLER
35         __extension__ enum bb_install_loc_t install_loc:8;
36 #endif
37 #if ENABLE_FEATURE_SUID
38         __extension__ enum bb_suid_t need_suid:8;
39 #endif
40 #if ENABLE_FEATURE_PREFER_APPLETS
41         /* true if instead of fork(); exec("applet"); waitpid();
42          * one can do fork(); exit(applet_main(argc,argv)); waitpid(); */
43         unsigned char noexec;
44         /* Even nicer */
45         /* true if instead of fork(); exec("applet"); waitpid();
46          * one can simply call applet_main(argc,argv); */
47         unsigned char nofork;
48 #endif
49 };
50
51 /* Defined in appletlib.c */
52 extern const struct bb_applet applets[];
53 extern const unsigned short NUM_APPLETS;
54 void bbox_prepare_main(char **argv);
55
56 #endif  /* _BB_INTERNAL_H_ */