Patch by Fillod Stephane, declare variables as static to not clobber
[oweals/busybox.git] / include / libbb.h
index edb8a6ed4568778517d01485f73a4def147d084c..2bb5ce02d346d9a83a819b7a7eac24a84bedcc00 100644 (file)
 # include "sha1.h"
 #endif
 
-/* Compatability with ANSI C */
-#ifndef inline
-# define inline
-#endif
-
-#if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__)
-/* libc5 doesn't define socklen_t */
-#ifndef _SOCKLEN_T
-#define _SOCKLEN_T
-typedef unsigned int socklen_t;
-#endif
-/* 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 
-
 /* Convenience macros to test the version of gcc. */
 #if defined __GNUC__ && defined __GNUC_MINOR__
 # define __GNUC_PREREQ(maj, min) \
@@ -197,8 +180,8 @@ void run_applet_by_name(const char *name, int argc, char **argv);
 extern void *xmalloc (size_t size);
 extern void *xrealloc(void *old, size_t size);
 extern void *xcalloc(size_t nmemb, size_t size);
-extern char *bb_xstrdup (const char *s);
 #endif
+extern char *bb_xstrdup (const char *s);
 extern char *bb_xstrndup (const char *s, int n);
 extern char * safe_strncpy(char *dst, const char *src, size_t size);
 
@@ -284,7 +267,8 @@ enum {
        MEGABYTE = (KILOBYTE*1024),
        GIGABYTE = (MEGABYTE*1024)
 };
-const char *make_human_readable_str(unsigned long size, unsigned long block_size, unsigned long display_unit);
+const char *make_human_readable_str(unsigned long long size, 
+               unsigned long block_size, unsigned long display_unit);
 
 int bb_ask_confirmation(void);
 int klogctl(int type, char * b, int len);
@@ -348,6 +332,21 @@ extern const char * const bb_path_group_file;
 extern const char * const bb_path_securetty_file;
 extern const char * const bb_path_motd_file;
 
+/*
+ * You can change LIBBB_DEFAULT_LOGIN_SHELL, but don`t use,
+ * use bb_default_login_shell and next defines,
+ * if you LIBBB_DEFAULT_LOGIN_SHELL change,
+ * don`t lose change increment constant!
+ */
+#define LIBBB_DEFAULT_LOGIN_SHELL      "-/bin/sh"
+
+extern const char * const bb_default_login_shell;
+/* "/bin/sh" */
+#define DEFAULT_SHELL     (bb_default_login_shell+1)
+/* "sh" */
+#define DEFAULT_SHELL_SHORT_NAME     (bb_default_login_shell+6)
+
+
 extern const char bb_path_mtab_file[];
 
 extern int bb_default_error_retval;
@@ -359,10 +358,19 @@ extern int bb_default_error_retval;
 # 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"
+#if defined(__sh__) || defined(__H8300H__) || defined(__H8300S__)
+/* Yes, this sucks, but both SH (including sh64) and H8 have a SCI(F) for their
+   respective serial ports .. as such, we can't use the common device paths for
+   these. -- PFM */
+#  define SC_0 "/dev/ttsc/0"
+#  define SC_1 "/dev/ttsc/1"
+#  define SC_FORMAT "/dev/ttsc/%d"
+#else
+#  define SC_0 "/dev/tts/0"
+#  define SC_1 "/dev/tts/1"
+#  define SC_FORMAT "/dev/tts/%d"
+#endif
 # define VC_FORMAT "/dev/vc/%d"
-# define SC_FORMAT "/dev/tts/%d"
 # define LOOP_FORMAT "/dev/loop/%d"
 #else
 # define CURRENT_VC "/dev/tty0"
@@ -371,10 +379,16 @@ extern int bb_default_error_retval;
 # 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"
+#if defined(__sh__) || defined(__H8300H__) || defined(__H8300S__)
+#  define SC_0 "/dev/ttySC0"
+#  define SC_1 "/dev/ttySC1"
+#  define SC_FORMAT "/dev/ttySC%d"
+#else
+#  define SC_0 "/dev/ttyS0"
+#  define SC_1 "/dev/ttyS1"
+#  define SC_FORMAT "/dev/ttyS%d"
+#endif
 # define VC_FORMAT "/dev/tty%d"
-# define SC_FORMAT "/dev/ttyS%d"
 # define LOOP_FORMAT "/dev/loop%d"
 #endif
 
@@ -397,12 +411,13 @@ void bb_xasprintf(char **string_ptr, const char *format, ...) __attribute__ ((fo
 
 #define FAIL_DELAY    3
 extern void change_identity ( const struct passwd *pw );
+extern const char *change_identity_e2str ( const struct passwd *pw );
 extern void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args
 #ifdef CONFIG_SELINUX
        , security_id_t sid
 #endif
 );
-extern int run_parts(char **args, const unsigned char test_mode);
+extern int run_parts(char **args, const unsigned char test_mode, char **env);
 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 );
@@ -447,7 +462,11 @@ typedef struct llist_s {
 } llist_t;
 extern llist_t *llist_add_to(llist_t *old_head, char *new_item);
 
-void print_login_issue(const char *issue_file, const char *tty);
-void print_login_prompt(void);
+extern void print_login_issue(const char *issue_file, const char *tty);
+extern void print_login_prompt(void);
+
+extern void vfork_daemon_rexec(int argc, char **argv, char *foreground_opt);
+extern void get_terminal_width_height(int fd, int *width, int *height);
+extern unsigned long get_ug_id(const char *s, long (*my_getxxnam)(const char *));
 
 #endif /* __LIBCONFIG_H__ */