blob: befbea544c440fd975e8031eb03cf2823449aea6 [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
Rob Landley193c8c72005-07-27 06:55:36 +000010#include "bb_config.h"
Eric Andersenf6b71392000-09-26 01:09:18 +000011
Robert Grieblc9aca452002-06-04 20:06:25 +000012#include "libbb.h"
Eric Andersenc3196012001-03-14 01:15:06 +000013
Eric Andersenf6b71392000-09-26 01:09:18 +000014enum Location {
15 _BB_DIR_ROOT = 0,
16 _BB_DIR_BIN,
17 _BB_DIR_SBIN,
18 _BB_DIR_USR_BIN,
19 _BB_DIR_USR_SBIN
20};
21
Robert Grieblc9aca452002-06-04 20:06:25 +000022enum SUIDRoot {
23 _BB_SUID_NEVER = 0,
24 _BB_SUID_MAYBE,
25 _BB_SUID_ALWAYS
26};
27
Eric Andersenf6b71392000-09-26 01:09:18 +000028struct BB_applet {
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000029 const char *name;
30 int (*main) (int argc, char **argv);
Bernhard Reutner-Fischer86f5c992006-01-22 22:55:11 +000031 __extension__ enum Location location:4;
32 __extension__ enum SUIDRoot need_suid:4;
Eric Andersenf6b71392000-09-26 01:09:18 +000033};
Glenn L McGrath60a22ad2002-08-22 15:54:22 +000034
Eric Andersenf6b71392000-09-26 01:09:18 +000035/* From busybox.c */
36extern const struct BB_applet applets[];
37
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_ */