* Permission has been granted to redistribute this code under the GPL.
*
*/
-#ifndef __LIBBB_H__
-#define __LIBBB_H__ 1
+#ifndef __LIBCONFIG_H__
+#define __LIBCONFIG_H__ 1
#include <stdio.h>
#include <stdarg.h>
#include <netdb.h>
#ifdef DMALLOC
-#include "dmalloc.h"
+#include <dmalloc.h>
#endif
#include <features.h>
-#ifndef _BB_INTERNAL_H_
-#include "../busybox.h"
+#include "config.h"
+
+#include "pwd_.h"
+#include "grp_.h"
+#ifdef CONFIG_FEATURE_SHADOWPASSWDS
+#include "shadow_.h"
+#endif
+#ifdef CONFIG_FEATURE_SHA1_PASSWORDS
+# include "sha1.h"
#endif
-#if __GNU_LIBRARY__ < 5
+
+#if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__)
/* libc5 doesn't define socklen_t */
typedef unsigned int socklen_t;
/* libc5 doesn't implement BSD 4.4 daemon() */
extern int daemon (int nochdir, int noclose);
+/* libc5 doesn't implement strtok_r */
+char *strtok_r(char *s, const char *delim, char **ptrptr);
#endif
/* Some useful definitions */
#define BUF_SIZE 8192
#define EXPAND_ALLOC 1024
-static inline int is_decimal(int ch) { return ((ch >= '0') && (ch <= '9')); }
-static inline int is_octal(int ch) { return ((ch >= '0') && (ch <= '7')); }
-
/* Macros for min/max. */
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
char* filesystemType, long flags, char* string_flags);
extern void erase_mtab(const char * name);
extern long atoi_w_units (const char *cp);
-extern pid_t* find_pid_by_name( char* pidName);
+extern long* find_pid_by_name( char* pidName);
extern char *find_real_root_device_name(const char* name);
extern char *get_line_from_file(FILE *file);
extern void print_file(FILE *file);
char *concat_path_file(const char *path, const char *filename);
char *last_char_is(const char *s, int c);
-typedef struct file_headers_s {
- char *name;
- char *link_name;
- off_t size;
- uid_t uid;
- gid_t gid;
- mode_t mode;
- time_t mtime;
- dev_t device;
-} file_header_t;
-file_header_t *get_header_ar(FILE *in_file);
-file_header_t *get_header_cpio(FILE *src_stream);
-file_header_t *get_header_tar(FILE *tar_stream);
-
-enum extract_functions_e {
- extract_verbose_list = 1,
- extract_list = 2,
- extract_one_to_buffer = 4,
- extract_to_stdout = 8,
- extract_all_to_fs = 16,
- extract_preserve_date = 32,
- extract_data_tar_gz = 64,
- extract_control_tar_gz = 128,
- extract_unzip_only = 256,
- extract_unconditional = 512,
- extract_create_leading_dirs = 1024
-};
-char *unarchive(FILE *src_stream, file_header_t *(*get_header)(FILE *),
- const int extract_function, const char *prefix, char **extract_names);
-char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function,
- const char *prefix, const char *filename);
-char *read_package_field(const char *package_buffer);
+extern long arith (const char *startbuf, int *errcode);
+
+int read_package_field(const char *package_buffer, char **field_name, char **field_value);
char *fgets_str(FILE *file, const char *terminating_string);
+extern int inflate(FILE *in, FILE *out);
extern int unzip(FILE *l_in_file, FILE *l_out_file);
extern void gz_close(int gunzip_pid);
extern FILE *gz_open(FILE *compressed_file, int *pid);
extern struct hostent *xgethostbyname(const char *name);
+extern struct hostent *xgethostbyname2(const char *name, int af);
+extern int create_icmp_socket(void);
+extern int create_icmp6_socket(void);
+extern int xconnect(const char *host, const char *port);
+
+char *dirname (char *path);
-char *dirname (const char *path);
+int make_directory (char *path, long mode, int flags);
-static inline char *strdup_substr (const char *s, int start, int end)
-{
- return xstrndup (s+start, end-start);
-}
-int make_directory (char *path, mode_t mode, int flags);
+const char *u_signal_names(const char *str_sig, int *signo, int startnum);
+char *simplify_path(const char *path);
#define CT_AUTO 0
#define CT_UNIX2DOS 1
enum {
FILEUTILS_PRESERVE_STATUS = 1,
- FILEUTILS_PRESERVE_SYMLINKS = 2,
+ FILEUTILS_DEREFERENCE = 2,
FILEUTILS_RECUR = 4,
FILEUTILS_FORCE = 8,
FILEUTILS_INTERACTIVE = 16
extern const char * const too_few_args;
extern const char * const name_longer_than_foo;
extern const char * const unknown;
+extern const char * const can_not_create_raw_socket;
+extern const char * const nologin_file;
+extern const char * const passwd_file;
+extern const char * const shadow_file;
+extern const char * const gshadow_file;
+extern const char * const group_file;
+extern const char * const securetty_file;
+extern const char * const motd_file;
+extern const char * const issue_file;
+extern const char * const _path_login;
+
+#ifdef CONFIG_FEATURE_DEVFS
+# define CURRENT_VC "/dev/vc/0"
+# define VC_1 "/dev/vc/1"
+# define VC_2 "/dev/vc/2"
+# define VC_3 "/dev/vc/3"
+# define VC_4 "/dev/vc/4"
+# define VC_5 "/dev/vc/5"
+# define SC_0 "/dev/tts/0"
+# define SC_1 "/dev/tts/1"
+# define VC_FORMAT "/dev/vc/%d"
+# define SC_FORMAT "/dev/tts/%d"
+# define LOOP_FORMAT "/dev/loop/%d"
+#else
+# define CURRENT_VC "/dev/tty0"
+# define VC_1 "/dev/tty1"
+# define VC_2 "/dev/tty2"
+# define VC_3 "/dev/tty3"
+# define VC_4 "/dev/tty4"
+# define VC_5 "/dev/tty5"
+# define SC_0 "/dev/ttyS0"
+# define SC_1 "/dev/ttyS1"
+# define VC_FORMAT "/dev/tty%d"
+# define SC_FORMAT "/dev/ttyS%d"
+# define LOOP_FORMAT "/dev/loop%d"
+#endif
+
+/* The following devices are the same on devfs and non-devfs systems. */
+#define CURRENT_TTY "/dev/tty"
+#define CONSOLE_DEV "/dev/console"
+
+int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name);
+void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
+void reset_ino_dev_hashtable(void);
+
+/* Stupid gcc always includes its own builtin strlen()... */
+extern size_t xstrlen(const char *string);
+#define strlen(x) xstrlen(x)
+
+void bb_asprintf(char **string_ptr, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
+
+
+#define FAIL_DELAY 3
+extern void change_identity ( const struct passwd *pw );
+extern void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args );
+extern int restricted_shell ( const char *shell );
+extern void setup_environment ( const char *shell, int loginshell, int changeenv, const struct passwd *pw );
+extern int correct_password ( const struct passwd *pw );
+extern char *pw_encrypt(const char *clear, const char *salt);
+extern struct spwd *pwd_to_spwd(const struct passwd *pw);
+extern int obscure(const char *old, const char *newval, const struct passwd *pwdp);
-#endif /* __LIBBB_H__ */
+#endif /* __LIBCONFIG_H__ */