//Turn on fbset readmode support
//#define BB_FEATURE_FBSET_READMODE
//
-// You must enable one or both of these features
-// Support installing modules from pre 2.1 kernels
-//#define BB_FEATURE_INSMOD_OLD_KERNEL
-// Support installing modules from kernel versions after 2.1.18
-#define BB_FEATURE_INSMOD_NEW_KERNEL
-//
-// You must enable one or both of these features
-// Support modules status from pre 2.1 kernels
-//#define BB_FEATURE_LSMOD_OLD_KERNEL
-// Support modules status from kernel versions after 2.1.18
-#define BB_FEATURE_LSMOD_NEW_KERNEL
+// Support insmod/lsmod/rmmod for post 2.1 kernels
+//#define BB_FEATURE_NEW_MODULE_INTERFACE
+//
+// Support insmod/lsmod/rmmod for pre 2.1 kernels
+//#define BB_FEATURE_OLD_MODULE_INTERFACE
//
// Support module version checking
//#define BB_FEATURE_INSMOD_VERSION_CHECKING
#ifdef BB_FEATURE_MOUNT_MTAB_SUPPORT
#define BB_MTAB
#endif
-#endif
+#else
+#undef BB_MTAB
+#endif
//
#if defined BB_FEATURE_SH_COMMAND_EDITING && defined BB_SH
#define BB_CMDEDIT
#endif
#endif
//
-#ifdef BB_FEATURE_LINUXRC
+#if defined BB_FEATURE_LINUXRC || defined BB_LINUXRC
#ifndef BB_INIT
#define BB_INIT
#endif
+#ifndef BB_LINUXRC
#define BB_LINUXRC
#endif
+#endif
//
#ifdef BB_GZIP
#ifndef BB_GUNZIP
#endif
#endif
//
-#if defined BB_INSMOD
-#ifndef BB_FEATURE_INSMOD_OLD_KERNEL
-#define BB_FEATURE_INSMOD_NEW_KERNEL
+#if defined BB_INSMOD || defined BB_LSMOD
+#ifndef BB_FEATURE_NEW_MODULE_INTERFACE
+#define BB_FEATURE_NEW_MODULE_INTERFACE
#endif
#endif
{
struct BB_applet search_applet, *applet;
const char *s;
- applet_name = "busybox";
-
-#ifdef BB_FEATURE_INSTALLER
- /*
- * This style of argument parsing doesn't scale well
- * in the event that busybox starts wanting more --options.
- * If someone has a cleaner approach, by all means implement it.
- */
- if (argc > 1 && (strcmp(argv[1], "--install") == 0)) {
- int use_symbolic_links = 0;
- int rc = 0;
- char *busybox;
-
- /* to use symlinks, or not to use symlinks... */
- if (argc > 2) {
- if ((strcmp(argv[2], "-s") == 0)) {
- use_symbolic_links = 1;
- }
- }
-
- /* link */
- busybox = busybox_fullpath();
- if (busybox) {
- install_links(busybox, use_symbolic_links);
- free(busybox);
- } else {
- rc = 1;
- }
- return rc;
- }
-#endif /* BB_FEATURE_INSTALLER */
for (s = applet_name = argv[0]; *s != '\0';) {
if (*s++ == '/')
exit((*(applet->main)) (argc, argv));
}
- return(busybox_main(argc, argv));
+ error_msg_and_die("applet not found\n");
}
{
int col = 0, len, i;
+#ifdef BB_FEATURE_INSTALLER
+ /*
+ * This style of argument parsing doesn't scale well
+ * in the event that busybox starts wanting more --options.
+ * If someone has a cleaner approach, by all means implement it.
+ */
+ if (argc > 1 && (strcmp(argv[1], "--install") == 0)) {
+ int use_symbolic_links = 0;
+ int rc = 0;
+ char *busybox;
+
+ /* to use symlinks, or not to use symlinks... */
+ if (argc > 2) {
+ if ((strcmp(argv[2], "-s") == 0)) {
+ use_symbolic_links = 1;
+ }
+ }
+
+ /* link */
+ busybox = busybox_fullpath();
+ if (busybox) {
+ install_links(busybox, use_symbolic_links);
+ free(busybox);
+ } else {
+ rc = 1;
+ }
+ return rc;
+ }
+#endif /* BB_FEATURE_INSTALLER */
+
argc--;
/* If we've already been here once, exit now */
{
struct BB_applet search_applet, *applet;
const char *s;
- applet_name = "busybox";
-
-#ifdef BB_FEATURE_INSTALLER
- /*
- * This style of argument parsing doesn't scale well
- * in the event that busybox starts wanting more --options.
- * If someone has a cleaner approach, by all means implement it.
- */
- if (argc > 1 && (strcmp(argv[1], "--install") == 0)) {
- int use_symbolic_links = 0;
- int rc = 0;
- char *busybox;
-
- /* to use symlinks, or not to use symlinks... */
- if (argc > 2) {
- if ((strcmp(argv[2], "-s") == 0)) {
- use_symbolic_links = 1;
- }
- }
-
- /* link */
- busybox = busybox_fullpath();
- if (busybox) {
- install_links(busybox, use_symbolic_links);
- free(busybox);
- } else {
- rc = 1;
- }
- return rc;
- }
-#endif /* BB_FEATURE_INSTALLER */
for (s = applet_name = argv[0]; *s != '\0';) {
if (*s++ == '/')
exit((*(applet->main)) (argc, argv));
}
- return(busybox_main(argc, argv));
+ error_msg_and_die("applet not found\n");
}
{
int col = 0, len, i;
+#ifdef BB_FEATURE_INSTALLER
+ /*
+ * This style of argument parsing doesn't scale well
+ * in the event that busybox starts wanting more --options.
+ * If someone has a cleaner approach, by all means implement it.
+ */
+ if (argc > 1 && (strcmp(argv[1], "--install") == 0)) {
+ int use_symbolic_links = 0;
+ int rc = 0;
+ char *busybox;
+
+ /* to use symlinks, or not to use symlinks... */
+ if (argc > 2) {
+ if ((strcmp(argv[2], "-s") == 0)) {
+ use_symbolic_links = 1;
+ }
+ }
+
+ /* link */
+ busybox = busybox_fullpath();
+ if (busybox) {
+ install_links(busybox, use_symbolic_links);
+ free(busybox);
+ } else {
+ rc = 1;
+ }
+ return rc;
+ }
+#endif /* BB_FEATURE_INSTALLER */
+
argc--;
/* If we've already been here once, exit now */
static unsigned short terminal_width;
static unsigned short column_width;
static unsigned short tabstops;
+#else
+# define column_width COLUMN_WIDTH
#endif
static int status = EXIT_SUCCESS;
column++;
}
}
- nexttab= column + column_width + COLUMN_GAP ;
+ nexttab= column + column_width + COLUMN_GAP;
}
/*----------------------------------------------------------------------*/
;
if (column_width < len) column_width= len;
}
-#endif
ncols= (int)(terminal_width / (column_width + COLUMN_GAP));
+#else
+ ncols= TERMINAL_WIDTH;
+#endif
switch (style_fmt) {
case STYLE_LONG: /* one record per line, extended info */
case STYLE_SINGLE: /* one record per line */
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.37 2001/01/24 19:07:09 andersen Exp $"
+#ident "$Id: insmod.c,v 1.38 2001/01/24 23:34:48 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.37 2001/01/24 19:07:09 andersen Exp $"
+#ident "$Id: insmod.c,v 1.38 2001/01/24 23:34:48 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
#define _PATH_MODULES "/lib/modules"
static const int STRVERSIONLEN = 32;
-#if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL)
-#error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined"
-#endif
-
/*======================================================================*/
int flag_force_load = 0;
-- Bryan Rittmeyer <bryan@ixiacom.com> */
-#ifdef BB_FEATURE_INSMOD_OLD_KERNEL
+#ifdef BB_FEATURE_OLD_MODULE_INTERFACE
_syscall1(int, get_kernel_syms, struct old_kernel_sym *, ks)
#endif
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
-#ifdef BB_FEATURE_INSMOD_OLD_KERNEL
+#ifdef BB_FEATURE_OLD_MODULE_INTERFACE
/* Fetch all the symbols and divvy them up as appropriate for the modules. */
#define old_create_mod_use_count(x) TRUE
#define old_init_module(x, y, z) TRUE
-#endif /* BB_FEATURE_INSMOD_OLD_KERNEL */
+#endif /* BB_FEATURE_OLD_MODULE_INTERFACE */
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
-#ifdef BB_FEATURE_INSMOD_NEW_KERNEL
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
/* Fetch the loaded modules, and all currently exported symbols. */
#define new_create_module_ksymtab(x)
#define query_module(v, w, x, y, z) -1
-#endif /* BB_FEATURE_INSMOD_NEW_KERNEL */
+#endif /* BB_FEATURE_NEW_MODULE_INTERFACE */
/*======================================================================*/
k_new_syscalls = !query_module(NULL, 0, NULL, 0, NULL);
if (k_new_syscalls) {
-#ifdef BB_FEATURE_INSMOD_NEW_KERNEL
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
if (!new_get_kernel_symbols())
goto out;
k_crcs = new_is_kernel_checksummed();
goto out;
#endif
} else {
-#ifdef BB_FEATURE_INSMOD_OLD_KERNEL
+#ifdef BB_FEATURE_OLD_MODULE_INTERFACE
if (!old_get_kernel_symbols(m_name))
goto out;
k_crcs = old_is_kernel_checksummed();
static unsigned short terminal_width;
static unsigned short column_width;
static unsigned short tabstops;
+#else
+# define column_width COLUMN_WIDTH
#endif
static int status = EXIT_SUCCESS;
column++;
}
}
- nexttab= column + column_width + COLUMN_GAP ;
+ nexttab= column + column_width + COLUMN_GAP;
}
/*----------------------------------------------------------------------*/
;
if (column_width < len) column_width= len;
}
-#endif
ncols= (int)(terminal_width / (column_width + COLUMN_GAP));
+#else
+ ncols= TERMINAL_WIDTH;
+#endif
switch (style_fmt) {
case STYLE_LONG: /* one record per line, extended info */
case STYLE_SINGLE: /* one record per line */
-#if !defined(BB_FEATURE_LSMOD_NEW_KERNEL) && !defined(BB_FEATURE_LSMOD_OLD_KERNEL)
-#error "Must have ether BB_FEATURE_LSMOD_NEW_KERNEL or BB_FEATURE_LSMOD_OLD_KERNEL defined"
-#endif
-
-#ifdef BB_FEATURE_LSMOD_NEW_KERNEL
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
struct module_info
{
return( 0);
}
-#else /*BB_FEATURE_LSMOD_OLD_KERNEL*/
+#else /*BB_FEATURE_OLD_MODULE_INTERFACE*/
#if ! defined BB_FEATURE_USE_PROCFS
#error Sorry, I depend on the /proc filesystem right now.
return 1;
}
-#endif /*BB_FEATURE_LSMOD_OLD_KERNEL*/
+#endif /*BB_FEATURE_OLD_MODULE_INTERFACE*/
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.37 2001/01/24 19:07:09 andersen Exp $"
+#ident "$Id: insmod.c,v 1.38 2001/01/24 23:34:48 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.37 2001/01/24 19:07:09 andersen Exp $"
+#ident "$Id: insmod.c,v 1.38 2001/01/24 23:34:48 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
#define _PATH_MODULES "/lib/modules"
static const int STRVERSIONLEN = 32;
-#if !defined(BB_FEATURE_INSMOD_NEW_KERNEL) && !defined(BB_FEATURE_INSMOD_OLD_KERNEL)
-#error "Must have ether BB_FEATURE_INSMOD_NEW_KERNEL or BB_FEATURE_INSMOD_OLD_KERNEL defined"
-#endif
-
/*======================================================================*/
int flag_force_load = 0;
-- Bryan Rittmeyer <bryan@ixiacom.com> */
-#ifdef BB_FEATURE_INSMOD_OLD_KERNEL
+#ifdef BB_FEATURE_OLD_MODULE_INTERFACE
_syscall1(int, get_kernel_syms, struct old_kernel_sym *, ks)
#endif
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
-#ifdef BB_FEATURE_INSMOD_OLD_KERNEL
+#ifdef BB_FEATURE_OLD_MODULE_INTERFACE
/* Fetch all the symbols and divvy them up as appropriate for the modules. */
#define old_create_mod_use_count(x) TRUE
#define old_init_module(x, y, z) TRUE
-#endif /* BB_FEATURE_INSMOD_OLD_KERNEL */
+#endif /* BB_FEATURE_OLD_MODULE_INTERFACE */
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
-#ifdef BB_FEATURE_INSMOD_NEW_KERNEL
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
/* Fetch the loaded modules, and all currently exported symbols. */
#define new_create_module_ksymtab(x)
#define query_module(v, w, x, y, z) -1
-#endif /* BB_FEATURE_INSMOD_NEW_KERNEL */
+#endif /* BB_FEATURE_NEW_MODULE_INTERFACE */
/*======================================================================*/
k_new_syscalls = !query_module(NULL, 0, NULL, 0, NULL);
if (k_new_syscalls) {
-#ifdef BB_FEATURE_INSMOD_NEW_KERNEL
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
if (!new_get_kernel_symbols())
goto out;
k_crcs = new_is_kernel_checksummed();
goto out;
#endif
} else {
-#ifdef BB_FEATURE_INSMOD_OLD_KERNEL
+#ifdef BB_FEATURE_OLD_MODULE_INTERFACE
if (!old_get_kernel_symbols(m_name))
goto out;
k_crcs = old_is_kernel_checksummed();
-#if !defined(BB_FEATURE_LSMOD_NEW_KERNEL) && !defined(BB_FEATURE_LSMOD_OLD_KERNEL)
-#error "Must have ether BB_FEATURE_LSMOD_NEW_KERNEL or BB_FEATURE_LSMOD_OLD_KERNEL defined"
-#endif
-
-#ifdef BB_FEATURE_LSMOD_NEW_KERNEL
+#ifdef BB_FEATURE_NEW_MODULE_INTERFACE
struct module_info
{
return( 0);
}
-#else /*BB_FEATURE_LSMOD_OLD_KERNEL*/
+#else /*BB_FEATURE_OLD_MODULE_INTERFACE*/
#if ! defined BB_FEATURE_USE_PROCFS
#error Sorry, I depend on the /proc filesystem right now.
return 1;
}
-#endif /*BB_FEATURE_LSMOD_OLD_KERNEL*/
+#endif /*BB_FEATURE_OLD_MODULE_INTERFACE*/
exit(EXIT_FAILURE);
}
-#if defined BB_INIT || defined BB_MKSWAP || defined BB_MOUNT
+#if defined BB_INIT || defined BB_MKSWAP || defined BB_MOUNT || defined BB_NFSMOUNT
/* Returns kernel version encoded as major*65536 + minor*256 + patch,
* so, for example, to check if the kernel is greater than 2.2.11:
* if (get_kernel_revision() <= 2*65536+2*256+11) { <stuff> }
}
#endif
-#if defined BB_FEATURE_NFSMOUNT || defined BB_LS || defined BB_SH || defined BB_WGET
+#if defined BB_NFSMOUNT || defined BB_LS || defined BB_SH || defined BB_WGET
# ifndef DMALLOC
extern char * xstrdup (const char *s) {
char *t;
# endif
#endif
-#if defined BB_FEATURE_NFSMOUNT
+#if defined BB_NFSMOUNT
extern char * xstrndup (const char *s, int n) {
char *t;