blob: 1c23b9bb01ee5bf1954cd07d5e17eb2de0929ab1 [file] [log] [blame]
Eric Andersenf6b71392000-09-26 01:09:18 +00001/* vi: set sw=4 ts=4: */
2/*
3 * Busybox main internal header file
4 *
Bernhard Reutner-Fischer86f5c992006-01-22 22:55:11 +00005 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
Eric Andersenf6b71392000-09-26 01:09:18 +00006 */
7#ifndef _BB_INTERNAL_H_
8#define _BB_INTERNAL_H_ 1
9
Robert Grieblc9aca452002-06-04 20:06:25 +000010#include "libbb.h"
Eric Andersenc3196012001-03-14 01:15:06 +000011
Denis Vlasenko335b63d2007-04-10 21:38:30 +000012#if ENABLE_FEATURE_INSTALLER
Denis Vlasenko0ee39992006-12-24 15:23:28 +000013/* order matters: used as index into "install_dir[]" in busybox.c */
Denis Vlasenko335b63d2007-04-10 21:38:30 +000014typedef enum bb_install_loc_t {
Eric Andersenf6b71392000-09-26 01:09:18 +000015 _BB_DIR_ROOT = 0,
16 _BB_DIR_BIN,
17 _BB_DIR_SBIN,
18 _BB_DIR_USR_BIN,
19 _BB_DIR_USR_SBIN
Denis Vlasenko335b63d2007-04-10 21:38:30 +000020} bb_install_loc_t;
21#endif
Eric Andersenf6b71392000-09-26 01:09:18 +000022
Denis Vlasenko335b63d2007-04-10 21:38:30 +000023#if ENABLE_FEATURE_SUID
24typedef enum bb_suid_t {
Robert Grieblc9aca452002-06-04 20:06:25 +000025 _BB_SUID_NEVER = 0,
26 _BB_SUID_MAYBE,
27 _BB_SUID_ALWAYS
Denis Vlasenko335b63d2007-04-10 21:38:30 +000028} bb_suid_t;
29#endif
Robert Grieblc9aca452002-06-04 20:06:25 +000030
Denis Vlasenko335b63d2007-04-10 21:38:30 +000031struct bb_applet {
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000032 const char *name;
33 int (*main) (int argc, char **argv);
Denis Vlasenko335b63d2007-04-10 21:38:30 +000034#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
Denis Vlasenko80d14be2007-04-10 23:03:30 +000040#if ENABLE_FEATURE_PREFER_APPLETS
Denis Vlasenko03fc4082007-04-11 07:36:31 +000041 /* true if instead of fork(); exec("applet"); waitpid();
Denis Vlasenkoc44ab012007-04-09 03:11:58 +000042 * one can do fork(); exit(applet_main(argc,argv)); waitpid(); */
43 unsigned char noexec;
44 /* Even nicer */
Denis Vlasenko03fc4082007-04-11 07:36:31 +000045 /* true if instead of fork(); exec("applet"); waitpid();
Denis Vlasenkoc44ab012007-04-09 03:11:58 +000046 * one can simply call applet_main(argc,argv); */
47 unsigned char nofork;
Denis Vlasenko335b63d2007-04-10 21:38:30 +000048#endif
Eric Andersenf6b71392000-09-26 01:09:18 +000049};
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000050
Denis Vlasenkod62fd842007-10-07 20:46:34 +000051/* Defined in appletlib.c */
Denis Vlasenko335b63d2007-04-10 21:38:30 +000052extern const struct bb_applet applets[];
Denis Vlasenko0ee39992006-12-24 15:23:28 +000053extern const unsigned short NUM_APPLETS;
Denis Vlasenko642a52d2007-10-07 21:00:41 +000054void bbox_prepare_main(char **argv);
Denis Vlasenko724d1962007-10-10 14:41:07 +000055#if ENABLE_BUILD_LIBBUSYBOX
56int libbusybox_main(int argc, char **argv);
57#endif
Eric Andersenf6b71392000-09-26 01:09:18 +000058
Denis Vlasenkoc7ba8b92007-02-03 17:27:14 +000059#endif /* _BB_INTERNAL_H_ */