blob: a7a0f4915f1b7704aab3ec6b93d44d2d076ec9dd [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 Vlasenko0ee39992006-12-24 15:23:28 +000012/* order matters: used as index into "install_dir[]" in busybox.c */
Eric Andersenf6b71392000-09-26 01:09:18 +000013enum Location {
14 _BB_DIR_ROOT = 0,
15 _BB_DIR_BIN,
16 _BB_DIR_SBIN,
17 _BB_DIR_USR_BIN,
18 _BB_DIR_USR_SBIN
19};
20
Robert Grieblc9aca452002-06-04 20:06:25 +000021enum SUIDRoot {
22 _BB_SUID_NEVER = 0,
23 _BB_SUID_MAYBE,
24 _BB_SUID_ALWAYS
25};
26
Eric Andersenf6b71392000-09-26 01:09:18 +000027struct BB_applet {
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000028 const char *name;
29 int (*main) (int argc, char **argv);
Bernhard Reutner-Fischer86f5c992006-01-22 22:55:11 +000030 __extension__ enum Location location:4;
31 __extension__ enum SUIDRoot need_suid:4;
Eric Andersenf6b71392000-09-26 01:09:18 +000032};
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000033
Denis Vlasenko0ee39992006-12-24 15:23:28 +000034/* From busybox.c and applet.c */
Eric Andersenf6b71392000-09-26 01:09:18 +000035extern const struct BB_applet applets[];
Denis Vlasenko0ee39992006-12-24 15:23:28 +000036extern const unsigned short NUM_APPLETS;
Eric Andersenf6b71392000-09-26 01:09:18 +000037
Eric Andersen8c725e62000-11-30 00:27:06 +000038/* Automagically pull in all the applet function prototypes and
Eric Andersen87559822000-12-01 19:02:24 +000039 * applet usage strings. These are all of the form:
Eric Andersen8c725e62000-11-30 00:27:06 +000040 * extern int foo_main(int argc, char **argv);
41 * extern const char foo_usage[];
Eric Andersenc7bda1c2004-03-15 08:29:22 +000042 * These are all autogenerated from the set of currently defined applets.
Eric Andersen8c725e62000-11-30 00:27:06 +000043 */
44#define PROTOTYPES
45#include "applets.h"
46#undef PROTOTYPES
Eric Andersenf6b71392000-09-26 01:09:18 +000047
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000048#endif /* _BB_INTERNAL_H_ */