X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Fbusybox.h;h=8b3647f57c593a9c342da19b9a6b266c7221d51e;hb=bdc88fdc6844ee6890e31ba4cf56800becc8c682;hp=8285494ef35fd2a2c55d241b2c8b7d71ef9c6d96;hpb=a88cb5025c3ffd9dc4e7bde58aa58b63afcf65bd;p=oweals%2Fbusybox.git diff --git a/include/busybox.h b/include/busybox.h index 8285494ef..8b3647f57 100644 --- a/include/busybox.h +++ b/include/busybox.h @@ -2,120 +2,54 @@ /* * Busybox main internal header file * - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Based in part on code from sash, Copyright (c) 1999 by David I. Bell - * Permission has been granted to redistribute this code under the GPL. - * + * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. */ #ifndef _BB_INTERNAL_H_ #define _BB_INTERNAL_H_ 1 -#include "config.h" - -#include -#include -#include -#include - -#define BB_BANNER "BusyBox v" BB_VER " (" BB_BT ")" - -#ifdef DMALLOC -#include -#endif - -#include - -/* Pull in the utility routines from libbb */ #include "libbb.h" -enum Location { +#if ENABLE_FEATURE_INSTALLER +/* order matters: used as index into "install_dir[]" in busybox.c */ +typedef enum bb_install_loc_t { _BB_DIR_ROOT = 0, _BB_DIR_BIN, _BB_DIR_SBIN, _BB_DIR_USR_BIN, _BB_DIR_USR_SBIN -}; +} bb_install_loc_t; +#endif -enum SUIDRoot { +#if ENABLE_FEATURE_SUID +typedef enum bb_suid_t { _BB_SUID_NEVER = 0, _BB_SUID_MAYBE, _BB_SUID_ALWAYS -}; +} bb_suid_t; +#endif -struct BB_applet { +struct bb_applet { const char *name; int (*main) (int argc, char **argv); - enum Location location:4; - enum SUIDRoot need_suid:4; -}; - -/* From busybox.c */ -extern const struct BB_applet applets[]; - -/* Automagically pull in all the applet function prototypes and - * applet usage strings. These are all of the form: - * extern int foo_main(int argc, char **argv); - * extern const char foo_usage[]; - * These are all autogenerated from the set of currently defined applets. - */ -#define PROTOTYPES -#include "applets.h" -#undef PROTOTYPES - -#ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK -#define RESERVE_CONFIG_BUFFER(buffer,len) char buffer[len] -#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len] -#define RELEASE_CONFIG_BUFFER(buffer) ((void)0) -#else -#ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS -#define RESERVE_CONFIG_BUFFER(buffer,len) static char buffer[len] -#define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len] -#define RELEASE_CONFIG_BUFFER(buffer) ((void)0) -#else -#define RESERVE_CONFIG_BUFFER(buffer,len) char *buffer=xmalloc(len) -#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len) -#define RELEASE_CONFIG_BUFFER(buffer) free (buffer) -#endif +#if ENABLE_FEATURE_INSTALLER + __extension__ enum bb_install_loc_t install_loc:8; #endif - - -/* Bit map related macros -- libc5 doens't provide these... sigh. */ -#ifndef setbit -#ifndef NBBY -#define NBBY CHAR_BIT +#if ENABLE_FEATURE_SUID + __extension__ enum bb_suid_t need_suid:8; #endif -#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) -#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) -#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) -#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) -#endif - -#ifndef RB_POWER_OFF -/* Stop system and switch power off if possible. */ -#define RB_POWER_OFF 0x4321fedc +#if ENABLE_FEATURE_PREFER_APPLETS + /* true if instead of fork(); exec("applet"); waitpid(); + * one can do fork(); exit(applet_main(argc,argv)); waitpid(); */ + unsigned char noexec; + /* Even nicer */ + /* true if instead of fork(); exec("applet"); waitpid(); + * one can simply call applet_main(argc,argv); */ + unsigned char nofork; #endif +}; -/* Try to pull in PATH_MAX */ -#include - -/* for PATH_MAX on systems that don't have it in limits.h */ -#include -#ifndef PATH_MAX -#define PATH_MAX 256 -#endif +/* Defined in applet.c */ +extern const struct bb_applet applets[]; +extern const unsigned short NUM_APPLETS; -#endif /* _BB_INTERNAL_H_ */ +#endif /* _BB_INTERNAL_H_ */