#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
+#include <dirent.h>
#include <stdint.h>
+#include <netinet/in.h>
#include <netdb.h>
#include <features.h>
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
+/* buffer allocation schemes */
+#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
+#endif
+
+
extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
extern const char *bb_mode_string(int mode);
extern int is_directory(const char *name, int followLinks, struct stat *statBuf);
+extern DIR *bb_opendir(const char *path);
+extern DIR *bb_xopendir(const char *path);
extern int remove_file(const char *path, int flags);
extern int copy_file(const char *source, const char *dest, int flags);
extern void bb_fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN;
extern void xstat(const char *filename, struct stat *buf);
+extern int bb_xsocket(int domain, int type, int protocol);
#define BB_GETOPT_ERROR 0x80000000UL
extern const char *bb_opt_complementally;
extern void print_login_issue(const char *issue_file, const char *tty);
extern void print_login_prompt(void);
+#if defined(__uClinux__)
extern void vfork_daemon_rexec(int nochdir, int noclose,
int argc, char **argv, char *foreground_opt);
+#endif
+
extern int get_terminal_width_height(int fd, int *width, int *height);
extern unsigned long get_ug_id(const char *s, long (*__bb_getxxnam)(const char *));
void md5_hash(const void *data, size_t length, md5_ctx_t *ctx);
void *md5_end(void *resbuf, md5_ctx_t *ctx);
+extern uint32_t *bb_crc32_filltable (int endian);
+
/* busybox.h will include dmalloc later for us, else include it here. */
#if !defined _BB_INTERNAL_H_ && defined DMALLOC
#include <dmalloc.h>