1 /* vi: set sw=4 ts=4: */
3 * Busybox main internal header file
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
21 * Permission has been granted to redistribute this code under the GPL.
24 #ifndef _BB_INTERNAL_H_
25 #define _BB_INTERNAL_H_ 1
32 #include <sys/types.h>
34 #define BB_BANNER "BusyBox v" BB_VER " (" BB_BT ")"
42 /* Pull in the utility routines from libbb */
61 int (*main) (int argc, char **argv);
62 enum Location location:4;
63 enum SUIDRoot need_suid:4;
67 extern const struct BB_applet applets[];
69 /* Automagically pull in all the applet function prototypes and
70 * applet usage strings. These are all of the form:
71 * extern int foo_main(int argc, char **argv);
72 * extern const char foo_usage[];
73 * These are all autogenerated from the set of currently defined applets.
79 #ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK
80 #define RESERVE_CONFIG_BUFFER(buffer,len) char buffer[len]
81 #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len]
82 #define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
84 #ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS
85 #define RESERVE_CONFIG_BUFFER(buffer,len) static char buffer[len]
86 #define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len]
87 #define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
89 #define RESERVE_CONFIG_BUFFER(buffer,len) char *buffer=xmalloc(len)
90 #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
91 #define RELEASE_CONFIG_BUFFER(buffer) free (buffer)
96 /* Bit map related macros -- libc5 doens't provide these... sigh. */
99 #define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
100 #define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
101 #define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
102 #define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
106 /* Stop system and switch power off if possible. */
107 #define RB_POWER_OFF 0x4321fedc
110 /* Try to pull in PATH_MAX */
113 /* for PATH_MAX on systems that don't have it in limits.h */
114 #include <sys/param.h>
119 #endif /* _BB_INTERNAL_H_ */