diff -Naur busybox-1.00-pre3.orig/.config busybox-1.00-pre3/.config --- busybox-1.00-pre3.orig/.config 1970-01-01 03:00:00.000000000 +0300 +++ busybox-1.00-pre3/.config 2003-11-07 17:47:59.000000000 +0300 @@ -0,0 +1,387 @@ +# +# Automatically generated make config: don't edit +# +HAVE_DOT_CONFIG=y + +# +# General Configuration +# +# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set +CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y +# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set +# CONFIG_FEATURE_VERBOSE_USAGE is not set +# CONFIG_FEATURE_INSTALLER is not set +# CONFIG_LOCALE_SUPPORT is not set +CONFIG_FEATURE_DEVFS=y +# CONFIG_FEATURE_DEVPTS is not set +# CONFIG_FEATURE_CLEAN_UP is not set +# CONFIG_FEATURE_SUID is not set +# CONFIG_SELINUX is not set + +# +# Build Options +# +# CONFIG_STATIC is not set +# CONFIG_LFS is not set +# USING_CROSS_COMPILER is not set +EXTRA_CFLAGS_OPTIONS="" + +# +# Installation Options +# +# CONFIG_INSTALL_NO_USR is not set +PREFIX="./_install" + +# +# Archival Utilities +# +# CONFIG_AR is not set +# CONFIG_BUNZIP2 is not set +# CONFIG_CPIO is not set +# CONFIG_DPKG is not set +# CONFIG_DPKG_DEB is not set +CONFIG_GUNZIP=y +# CONFIG_FEATURE_GUNZIP_UNCOMPRESS is not set +CONFIG_GZIP=y +# CONFIG_RPM2CPIO is not set +# CONFIG_RPM is not set +CONFIG_TAR=y +CONFIG_FEATURE_TAR_CREATE=y +# CONFIG_FEATURE_TAR_BZIP2 is not set +# CONFIG_FEATURE_TAR_EXCLUDE is not set +CONFIG_FEATURE_TAR_GZIP=y +# CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY is not set +CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y +# CONFIG_FEATURE_UNARCHIVE_TAPE is not set +# CONFIG_UNCOMPRESS is not set +# CONFIG_UNZIP is not set + +# +# Coreutils +# +CONFIG_BASENAME=y +# CONFIG_CAL is not set +CONFIG_CAT=y +CONFIG_CHGRP=y +CONFIG_CHMOD=y +CONFIG_CHOWN=y +CONFIG_CHROOT=y +# CONFIG_CMP is not set +CONFIG_CP=y +CONFIG_CUT=y +CONFIG_DATE=y +CONFIG_FEATURE_DATE_ISOFMT=y +CONFIG_DD=y +CONFIG_DF=y +CONFIG_DIRNAME=y +# CONFIG_DOS2UNIX is not set +CONFIG_DU=y +CONFIG_FEATURE_DU_DEFALT_BLOCKSIZE_1K=y +CONFIG_ECHO=y +CONFIG_FEATURE_FANCY_ECHO=y +CONFIG_ENV=y +CONFIG_EXPR=y +CONFIG_FALSE=y +# CONFIG_FOLD is not set +CONFIG_HEAD=y +# CONFIG_FEATURE_FANCY_HEAD is not set +# CONFIG_HOSTID is not set +CONFIG_ID=y +# CONFIG_LENGTH is not set +CONFIG_LN=y +# CONFIG_LOGNAME is not set +CONFIG_LS=y +CONFIG_FEATURE_LS_FILETYPES=y +CONFIG_FEATURE_LS_FOLLOWLINKS=y +# CONFIG_FEATURE_LS_RECURSIVE is not set +CONFIG_FEATURE_LS_SORTFILES=y +CONFIG_FEATURE_LS_TIMESTAMPS=y +CONFIG_FEATURE_LS_USERNAME=y +CONFIG_FEATURE_LS_COLOR=y +# CONFIG_MD5SUM is not set +CONFIG_MKDIR=y +CONFIG_MKFIFO=y +CONFIG_MKNOD=y +CONFIG_MV=y +# CONFIG_OD is not set +# CONFIG_PRINTF is not set +CONFIG_PWD=y +# CONFIG_REALPATH is not set +CONFIG_RM=y +CONFIG_RMDIR=y +# CONFIG_SHA1SUM is not set +CONFIG_SLEEP=y +# CONFIG_FEATURE_FANCY_SLEEP is not set +CONFIG_SORT=y +# CONFIG_FEATURE_SORT_REVERSE is not set +# CONFIG_FEATURE_SORT_UNIQUE is not set +CONFIG_STTY=y +CONFIG_SYNC=y +CONFIG_TAIL=y +# CONFIG_FEATURE_FANCY_TAIL is not set +# CONFIG_TEE is not set +CONFIG_TEST=y + +# +# test (forced enabled for use with shell) +# +CONFIG_TOUCH=y +CONFIG_TR=y +CONFIG_TRUE=y +CONFIG_TTY=y +CONFIG_UNAME=y +CONFIG_UNIQ=y +CONFIG_USLEEP=y +# CONFIG_UUDECODE is not set +# CONFIG_UUENCODE is not set +# CONFIG_WATCH is not set +CONFIG_WC=y +# CONFIG_WHO is not set +CONFIG_WHOAMI=y +CONFIG_YES=y + +# +# Common options for cp and mv +# +# CONFIG_FEATURE_PRESERVE_HARDLINKS is not set + +# +# Common options for ls and more +# +CONFIG_FEATURE_AUTOWIDTH=y + +# +# Common options for df, du, ls +# +CONFIG_FEATURE_HUMAN_READABLE=y + +# +# Console Utilities +# +# CONFIG_CHVT is not set +CONFIG_CLEAR=y +# CONFIG_DEALLOCVT is not set +# CONFIG_DUMPKMAP is not set +# CONFIG_LOADACM is not set +# CONFIG_LOADFONT is not set +# CONFIG_LOADKMAP is not set +# CONFIG_OPENVT is not set +CONFIG_RESET=y +# CONFIG_SETKEYCODES is not set + +# +# Debian Utilities +# +# CONFIG_MKTEMP is not set +# CONFIG_READLINK is not set +# CONFIG_RUN_PARTS is not set +# CONFIG_START_STOP_DAEMON is not set +CONFIG_WHICH=y + +# +# Editors +# +# CONFIG_AWK is not set +# CONFIG_PATCH is not set +CONFIG_SED=y +# CONFIG_FEATURE_SED_EMBEDED_NEWLINE is not set +# CONFIG_VI is not set + +# +# Finding Utilities +# +# CONFIG_FIND is not set +CONFIG_GREP=y +CONFIG_FEATURE_GREP_EGREP_ALIAS=y +CONFIG_FEATURE_GREP_FGREP_ALIAS=y +CONFIG_FEATURE_GREP_CONTEXT=y +CONFIG_XARGS=y + +# +# Init Utilities +# +# CONFIG_INIT is not set +# CONFIG_HALT is not set +# CONFIG_POWEROFF is not set +# CONFIG_REBOOT is not set +# CONFIG_MINIT is not set +CONFIG_MESG=y + +# +# Login/Password Management Utilities +# +# CONFIG_USE_BB_PWD_GRP is not set +# CONFIG_ADDGROUP is not set +# CONFIG_DELGROUP is not set +# CONFIG_ADDUSER is not set +# CONFIG_DELUSER is not set +# CONFIG_GETTY is not set +# CONFIG_LOGIN is not set +# CONFIG_PASSWD is not set +# CONFIG_SU is not set +CONFIG_SULOGIN=y +# CONFIG_VLOCK is not set + +# +# Miscellaneous Utilities +# +# CONFIG_ADJTIMEX is not set +# CONFIG_CROND is not set +# CONFIG_CRONTAB is not set +# CONFIG_DC is not set +# CONFIG_LAST is not set +# CONFIG_HDPARM is not set +# CONFIG_MAKEDEVS is not set +# CONFIG_MT is not set +# CONFIG_STRINGS is not set +# CONFIG_TIME is not set +# CONFIG_WATCHDOG is not set + +# +# Linux Module Utilities +# +CONFIG_INSMOD=y +# CONFIG_FEATURE_OLD_MODULE_INTERFACE is not set +CONFIG_FEATURE_NEW_MODULE_INTERFACE=y + +# +# Support new (post 2.1) Linux kernels (Forced enabled) +# +# CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set +# CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set +# CONFIG_FEATURE_INSMOD_LOADINKMEM is not set +# CONFIG_FEATURE_INSMOD_LOAD_MAP is not set +CONFIG_LSMOD=y +CONFIG_FEATURE_QUERY_MODULE_INTERFACE=y +CONFIG_MODPROBE=y +CONFIG_RMMOD=y +CONFIG_FEATURE_CHECK_TAINTED_MODULE=y + +# +# Networking Utilities +# +# CONFIG_FEATURE_IPV6 is not set +# CONFIG_ARPING is not set +# CONFIG_FTPGET is not set +# CONFIG_FTPPUT is not set +CONFIG_HOSTNAME=y +# CONFIG_HTTPD is not set +CONFIG_IFCONFIG=y +CONFIG_FEATURE_IFCONFIG_STATUS=y +# CONFIG_FEATURE_IFCONFIG_SLIP is not set +# CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ is not set +CONFIG_FEATURE_IFCONFIG_HW=y +# CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS is not set +# CONFIG_IFUPDOWN is not set +# CONFIG_INETD is not set +# CONFIG_IP is not set +# CONFIG_IPCALC is not set +# CONFIG_IPADDR is not set +# CONFIG_IPLINK is not set +# CONFIG_IPROUTE is not set +# CONFIG_IPTUNNEL is not set +# CONFIG_NAMEIF is not set +# CONFIG_NC is not set +CONFIG_NETSTAT=y +CONFIG_NSLOOKUP=y +CONFIG_PING=y +CONFIG_FEATURE_FANCY_PING=y +CONFIG_ROUTE=y +# CONFIG_TELNET is not set +# CONFIG_TELNETD is not set +# CONFIG_TFTP is not set +# CONFIG_TRACEROUTE is not set +# CONFIG_VCONFIG is not set +# CONFIG_WGET is not set + +# +# udhcp Server/Client +# +# CONFIG_UDHCPD is not set +# CONFIG_UDHCPC is not set + +# +# Process Utilities +# +CONFIG_FREE=y +CONFIG_KILL=y +CONFIG_KILLALL=y +CONFIG_PIDOF=y +CONFIG_PS=y +# CONFIG_RENICE is not set +# CONFIG_TOP is not set +CONFIG_UPTIME=y + +# +# Another Bourne-like Shell +# +CONFIG_FEATURE_SH_IS_ASH=y +# CONFIG_FEATURE_SH_IS_HUSH is not set +# CONFIG_FEATURE_SH_IS_LASH is not set +# CONFIG_FEATURE_SH_IS_MSH is not set +# CONFIG_FEATURE_SH_IS_NONE is not set +CONFIG_ASH=y + +# +# Ash Shell Options +# +CONFIG_ASH_PIPE_OPTIMIZATION=y +CONFIG_FEATURE_BUILTIN_TEST=y +CONFIG_FEATURE_BUILTIN_ECHO=y +CONFIG_FEATURE_BUILTIN_PIDOF=y +CONFIG_ASH_ALIAS=y +CONFIG_ASH_MATH_SUPPORT=y +# CONFIG_ASH_GETOPTS is not set +# CONFIG_ASH_CMDCMD is not set +CONFIG_ASH_MAIL=y +# CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set +# CONFIG_HUSH is not set +# CONFIG_LASH is not set +# CONFIG_MSH is not set + +# +# Bourne Shell Options +# +CONFIG_FEATURE_COMMAND_EDITING=y +# CONFIG_FEATURE_COMMAND_SAVEHISTORY is not set +CONFIG_FEATURE_COMMAND_TAB_COMPLETION=y +# CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION is not set +CONFIG_FEATURE_COMMAND_HISTORY=15 +# CONFIG_FEATURE_SH_STANDALONE_SHELL is not set +# CONFIG_FEATURE_SH_FANCY_PROMPT is not set +# CONFIG_FEATURE_SH_EXTRA_QUIET is not set + +# +# System Logging Utilities +# +# CONFIG_SYSLOGD is not set +# CONFIG_LOGGER is not set + +# +# Linux System Utilities +# +CONFIG_DMESG=y +# CONFIG_FBSET is not set +# CONFIG_FDFLUSH is not set +# CONFIG_FDFORMAT is not set +# CONFIG_FDISK is not set +# CONFIG_FREERAMDISK is not set +# CONFIG_FSCK_MINIX is not set +# CONFIG_MKFS_MINIX is not set +# CONFIG_GETOPT is not set +# CONFIG_HEXDUMP is not set +# CONFIG_HWCLOCK is not set +# CONFIG_LOSETUP is not set +CONFIG_MKSWAP=y +CONFIG_MORE=y +CONFIG_FEATURE_USE_TERMIOS=y +# CONFIG_PIVOT_ROOT is not set +# CONFIG_RDATE is not set +CONFIG_SWAPONOFF=y +# CONFIG_MOUNT is not set +# CONFIG_UMOUNT is not set + +# +# Debugging Options +# +# CONFIG_DEBUG is not set diff -Naur busybox-1.00-pre3.orig/.config.cmd busybox-1.00-pre3/.config.cmd --- busybox-1.00-pre3.orig/.config.cmd 1970-01-01 03:00:00.000000000 +0300 +++ busybox-1.00-pre3/.config.cmd 2003-11-07 17:47:35.000000000 +0300 @@ -0,0 +1,22 @@ +deps_config := \ + util-linux/Config.in \ + sysklogd/Config.in \ + shell/Config.in \ + procps/Config.in \ + networking/udhcp/Config.in \ + networking/Config.in \ + modutils/Config.in \ + miscutils/Config.in \ + loginutils/Config.in \ + init/Config.in \ + findutils/Config.in \ + editors/Config.in \ + debianutils/Config.in \ + console-tools/Config.in \ + coreutils/Config.in \ + archival/Config.in \ + sysdeps/linux/Config.in + +.config include/config.h: $(deps_config) + +$(deps_config): diff -Naur busybox-1.00-pre3.orig/Rules.mak busybox-1.00-pre3/Rules.mak --- busybox-1.00-pre3.orig/Rules.mak 2003-09-12 08:34:26.000000000 +0400 +++ busybox-1.00-pre3/Rules.mak 2003-11-07 17:47:59.000000000 +0300 @@ -116,8 +116,8 @@ # for OPTIMIZATION... # use '-Os' optimization if available, else use -O2 -OPTIMIZATION= -OPTIMIZATION=${call check_gcc,-Os,-O2} +OPTIMIZATION=-O2 +#OPTIMIZATION=${call check_gcc,-Os,-O2} # Some nice architecture specific optimizations ifeq ($(strip $(TARGET_ARCH)),arm) @@ -169,6 +169,9 @@ ifeq ($(strip $(PREFIX)),) PREFIX:=`pwd`/_install endif +ifeq ($(strip $(CONFIG_SULOGIN)),y) + LIBRARIES:=-lcrypt +endif # Additional complications due to support for pristine source dir. # Include files in the build directory should take precedence over diff -Naur busybox-1.00-pre3.orig/coreutils/Config.in busybox-1.00-pre3/coreutils/Config.in --- busybox-1.00-pre3.orig/coreutils/Config.in 2003-08-26 08:28:05.000000000 +0400 +++ busybox-1.00-pre3/coreutils/Config.in 2003-11-07 17:47:35.000000000 +0300 @@ -166,7 +166,7 @@ config CONFIG_EXPR bool "expr" - default n + default y help expr is used to calculate numbers and print the result to standard output. @@ -305,7 +305,7 @@ config CONFIG_MKFIFO bool "mkfifo" - default n + default y help mkfifo is used to create FIFOs (named pipes). The `mknod' program can also create FIFOs. @@ -412,7 +412,7 @@ config CONFIG_STTY bool "stty" - default n + default y help stty is used to change and print terminal line settings. @@ -475,7 +475,7 @@ config CONFIG_TR bool "tr" - default n + default y help tr is used to squeeze, and/or delete characters from standard input, writing to standard output. @@ -541,7 +541,7 @@ config CONFIG_WC bool "wc" - default n + default y help wc is used to print the number of bytes, words, and lines, in specified files. diff -Naur busybox-1.00-pre3.orig/coreutils/echo.c busybox-1.00-pre3/coreutils/echo.c --- busybox-1.00-pre3.orig/coreutils/echo.c 2003-03-19 12:11:33.000000000 +0300 +++ busybox-1.00-pre3/coreutils/echo.c 2003-11-07 17:47:35.000000000 +0300 @@ -122,7 +122,11 @@ #endif DONE: - bb_fflush_stdout_and_exit(EXIT_SUCCESS); +#ifdef CONFIG_FEATURE_BUILTIN_ECHO + return EXIT_SUCCESS; +#else + bb_fflush_stdout_and_exit(EXIT_SUCCESS); +#endif } /*- diff -Naur busybox-1.00-pre3.orig/coreutils/test.c busybox-1.00-pre3/coreutils/test.c --- busybox-1.00-pre3.orig/coreutils/test.c 2003-07-15 01:20:45.000000000 +0400 +++ busybox-1.00-pre3/coreutils/test.c 2003-11-07 17:47:35.000000000 +0300 @@ -188,19 +188,19 @@ /* Implement special cases from POSIX.2, section 4.62.4 */ switch (argc) { case 1: - exit(1); + return (1); case 2: - exit(*argv[1] == '\0'); + return (*argv[1] == '\0'); case 3: if (argv[1][0] == '!' && argv[1][1] == '\0') { - exit(!(*argv[2] == '\0')); + return (!(*argv[2] == '\0')); } break; case 4: if (argv[1][0] != '!' || argv[1][1] != '\0') { if (t_lex(argv[2]), t_wp_op && t_wp_op->op_type == BINOP) { t_wp = &argv[1]; - exit(binop() == 0); + return (binop() == 0); } } break; @@ -208,7 +208,7 @@ if (argv[1][0] == '!' && argv[1][1] == '\0') { if (t_lex(argv[3]), t_wp_op && t_wp_op->op_type == BINOP) { t_wp = &argv[2]; - exit(!(binop() == 0)); + return (!(binop() == 0)); } } break; diff -Naur busybox-1.00-pre3.orig/findutils/Config.in busybox-1.00-pre3/findutils/Config.in --- busybox-1.00-pre3.orig/findutils/Config.in 2003-07-14 23:36:56.000000000 +0400 +++ busybox-1.00-pre3/findutils/Config.in 2003-11-07 17:47:35.000000000 +0300 @@ -92,7 +92,7 @@ config CONFIG_XARGS bool "xargs" - default n + default y help xargs is used to execute a specified command on every item from standard input. diff -Naur busybox-1.00-pre3.orig/include/applets.h busybox-1.00-pre3/include/applets.h --- busybox-1.00-pre3.orig/include/applets.h 2003-08-29 11:38:56.000000000 +0400 +++ busybox-1.00-pre3/include/applets.h 2003-11-07 17:47:59.000000000 +0300 @@ -415,6 +415,7 @@ #ifdef CONFIG_NETSTAT APPLET(netstat, netstat_main, _BB_DIR_BIN, _BB_SUID_NEVER) #endif + #ifdef CONFIG_NSLOOKUP APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) #endif diff -Naur busybox-1.00-pre3.orig/include/usage.h busybox-1.00-pre3/include/usage.h --- busybox-1.00-pre3.orig/include/usage.h 2003-08-29 18:18:26.000000000 +0400 +++ busybox-1.00-pre3/include/usage.h 2003-11-07 17:47:59.000000000 +0300 @@ -1760,6 +1760,13 @@ "quit\n" \ "221 foobar closing connection\n" +#define nice_trivial_usage \ + "[OPTION] [COMMAND [ARG]...]" +#define nice_full_usage \ + "Run COMMAND with an adjusted scheduling priority." +#define nice_example_usage \ + "$ nice -n 0 /tmp/foo \n" + #define netstat_trivial_usage \ "[-laenrtuwx]" #define netstat_full_usage \ diff -Naur busybox-1.00-pre3.orig/init/init.c busybox-1.00-pre3/init/init.c --- busybox-1.00-pre3.orig/init/init.c 2003-09-11 12:51:32.000000000 +0400 +++ busybox-1.00-pre3/init/init.c 2003-11-07 17:47:35.000000000 +0300 @@ -127,6 +127,9 @@ #define CTRLALTDEL 0x020 #define SHUTDOWN 0x040 #define RESTART 0x080 +#define POWERFAIL 0x100 +#define POWERWAIT 0x200 +#define IGNORE 0x400 /* A mapping between "inittab" action name strings and action type codes. */ struct init_action_type { @@ -143,6 +146,17 @@ {"ctrlaltdel", CTRLALTDEL}, {"shutdown", SHUTDOWN}, {"restart", RESTART}, + {"powerfail", POWERFAIL}, + {"powerwait", POWERWAIT}, + {"powerfailnow", POWERFAIL}, + + {"boot", IGNORE}, + {"bootwait", IGNORE}, + {"off", IGNORE}, + {"ondemand", IGNORE}, + {"initdefault", IGNORE}, + {"powerokwait", IGNORE}, + {"kbrequest", IGNORE}, {0, 0} }; @@ -483,7 +497,7 @@ /* If the init Action requires us to wait, then force the * supplied terminal to be the controlling tty. */ - if (a->action & (SYSINIT | WAIT | CTRLALTDEL | SHUTDOWN | RESTART)) { + if (a->action & (SYSINIT | WAIT | POWERWAIT | POWERFAIL | CTRLALTDEL | SHUTDOWN | RESTART)) { /* Now fork off another process to just hang around */ if ((pid = fork()) < 0) { @@ -491,7 +505,7 @@ _exit(1); } - if (pid > 0) { + if (pid > 0) { // do not wait on POWERFAIL /* We are the parent -- wait till the child is done */ signal(SIGINT, SIG_IGN); @@ -638,13 +652,14 @@ static void run_actions(int action) { struct init_action *a, *tmp; - for (a = init_action_list; a; a = tmp) { tmp = a->next; - if (a->action == action) { - if (a->action & (SYSINIT | WAIT | CTRLALTDEL | SHUTDOWN | RESTART)) { + if ((a->action & action) != 0) { + if (a->action & (SYSINIT | WAIT | POWERWAIT | CTRLALTDEL | SHUTDOWN | RESTART)) { waitfor(a); delete_init_action(a); + } else if (a->action & POWERFAIL) { + run(a); } else if (a->action & ONCE) { run(a); delete_init_action(a); @@ -718,7 +733,6 @@ { struct init_action *a, *tmp; sigset_t unblock_signals; - for (a = init_action_list; a; a = tmp) { tmp = a->next; if (a->action & RESTART) { @@ -816,6 +830,11 @@ run_actions(CTRLALTDEL); } +static void powerfail_signal(int sig) +{ + run_actions(POWERFAIL|POWERWAIT); +} + /* The SIGSTOP & SIGTSTP handler */ static void stop_handler(int sig) { @@ -839,13 +858,28 @@ static void new_init_action(int action, const char *command, const char *cons) { struct init_action *new_action, *a; - - if (*cons == '\0') + char tmpConsole[CONSOLE_BUFF_SIZE]; + int ttyNo, pos; + + if (*cons == '\0') { cons = console; + } else if (sscanf(cons, "%d%n", &ttyNo, &pos) == 1 && cons[pos] == '\0') { + sprintf(tmpConsole, "/dev/tty%d", ttyNo); + cons = tmpConsole; + } else { + if(strncmp(cons, "/dev/", 5) == 0) { + cons += 5; + } + strcpy(tmpConsole, "/dev/"); + safe_strncpy(tmpConsole + 5, cons, + CONSOLE_BUFF_SIZE - 5); + cons = tmpConsole; + } /* do not run entries if console device is not available */ - if (access(cons, R_OK | W_OK)) - return; + if (access(cons, R_OK | W_OK)) { + cons = console; + } if (strcmp(cons, "/dev/null") == 0 && (action & ASKFIRST)) return; @@ -936,7 +970,6 @@ #ifdef CONFIG_FEATURE_USE_INITTAB FILE *file; char buf[INIT_BUFFS_SIZE], lineAsRead[INIT_BUFFS_SIZE]; - char tmpConsole[CONSOLE_BUFF_SIZE]; char *id, *runlev, *action, *command, *eol; const struct init_action_type *a = actions; @@ -1005,7 +1038,7 @@ /* Separate the action from the command */ command = strchr(action, ':'); - if (command == NULL || *(command + 1) == '\0') { + if (command == NULL) { message(LOG | CONSOLE, "Bad inittab entry: %s", lineAsRead); continue; } else { @@ -1016,14 +1049,6 @@ /* Ok, now process it */ for (a = actions; a->name != 0; a++) { if (strcmp(a->name, action) == 0) { - if (*id != '\0') { - if(strncmp(id, "/dev/", 5) == 0) - id += 5; - strcpy(tmpConsole, "/dev/"); - safe_strncpy(tmpConsole + 5, id, - CONSOLE_BUFF_SIZE - 5); - id = tmpConsole; - } new_init_action(a->action, command, id); break; } @@ -1040,10 +1065,10 @@ static void reload_signal(int sig) { - message(LOG, "Reloading /etc/inittab"); - parse_inittab(); - run_actions(RESPAWN); - return; + message(LOG, "Reloading /etc/inittab"); + parse_inittab(); + run_actions(RESPAWN); + return; } extern int init_main(int argc, char **argv) @@ -1069,7 +1094,8 @@ signal(SIGHUP, exec_signal); signal(SIGUSR1, halt_signal); signal(SIGUSR2, halt_signal); - signal(SIGINT, ctrlaltdel_signal); + signal(SIGINT, ctrlaltdel_signal); + signal(SIGPWR, powerfail_signal); signal(SIGTERM, reboot_signal); signal(SIGCONT, cont_handler); signal(SIGSTOP, stop_handler); diff -Naur busybox-1.00-pre3.orig/modutils/Config.in busybox-1.00-pre3/modutils/Config.in --- busybox-1.00-pre3.orig/modutils/Config.in 2003-09-03 04:42:58.000000000 +0400 +++ busybox-1.00-pre3/modutils/Config.in 2003-11-07 17:47:35.000000000 +0300 @@ -7,7 +7,7 @@ config CONFIG_INSMOD bool "insmod" - default n + default y help insmod is used to load specified modules in the running kernel. @@ -85,7 +85,7 @@ config CONFIG_LSMOD bool "lsmod" - default n + default y help lsmod is used to display a list of loaded modules. @@ -100,14 +100,14 @@ config CONFIG_MODPROBE bool "modprobe" - default n + default y help Handle the loading of modules, and their dependancies on a high level. config CONFIG_RMMOD bool "rmmod" - default n + default y help rmmod is used to unload specified modules from the kernel. diff -Naur busybox-1.00-pre3.orig/procps/Config.in busybox-1.00-pre3/procps/Config.in --- busybox-1.00-pre3.orig/procps/Config.in 2003-07-22 13:59:33.000000000 +0400 +++ busybox-1.00-pre3/procps/Config.in 2003-11-07 17:47:35.000000000 +0300 @@ -32,7 +32,7 @@ config CONFIG_PIDOF bool "pidof" - default n + default y help Pidof finds the process id's (pids) of the named programs. It prints those id's on the standard output. diff -Naur busybox-1.00-pre3.orig/shell/Config.in busybox-1.00-pre3/shell/Config.in --- busybox-1.00-pre3.orig/shell/Config.in 2003-09-12 08:51:25.000000000 +0400 +++ busybox-1.00-pre3/shell/Config.in 2003-11-07 17:47:59.000000000 +0300 @@ -46,12 +46,33 @@ comment "Ash Shell Options" depends on CONFIG_ASH -config CONFIG_ASH_JOB_CONTROL - bool " Enable Job control" +config CONFIG_ASH_PIPE_OPTIMIZATION + bool " Enable ash pipe optimization " + default y + depends on CONFIG_ASH + help + Eliminate cat at the beginning of the pipe. + +config CONFIG_FEATURE_BUILTIN_TEST + bool " Builtin test command" default y depends on CONFIG_ASH help - Enable job control in the ash shell. + Builtin test command" + +config CONFIG_FEATURE_BUILTIN_ECHO + bool " Builtin echo command" + default y + depends on CONFIG_ASH + help + Builtin echo command" + +config CONFIG_FEATURE_BUILTIN_PIDOF + bool " Builtin pidof command" + default y + depends on CONFIG_ASH + help + Builtin pidof command" config CONFIG_ASH_ALIAS bool " Enable alias support" diff -Naur busybox-1.00-pre3.orig/shell/ash.c busybox-1.00-pre3/shell/ash.c --- busybox-1.00-pre3.orig/shell/ash.c 2003-09-02 06:36:17.000000000 +0400 +++ busybox-1.00-pre3/shell/ash.c 2003-11-07 17:47:59.000000000 +0300 @@ -1259,6 +1259,16 @@ #ifdef JOBS static int killcmd(int, char **); #endif +#ifdef CONFIG_FEATURE_BUILTIN_TEST +static int testcmd(int, char **); +#endif +#ifdef CONFIG_FEATURE_BUILTIN_ECHO +static int echocmd(int, char**); +#endif +#ifdef CONFIG_FEATURE_BUILTIN_PIDOF +static int pidofcmd(int, char **); +#endif + /* $NetBSD: mail.h,v 1.9 2002/11/24 22:35:40 christos Exp $ */ @@ -1281,39 +1291,6 @@ /* unsigned flags; */ }; -#ifdef CONFIG_ASH_CMDCMD -# ifdef JOBS -# ifdef CONFIG_ASH_ALIAS -# define COMMANDCMD (builtincmd + 7) -# define EXECCMD (builtincmd + 10) -# else -# define COMMANDCMD (builtincmd + 6) -# define EXECCMD (builtincmd + 9) -# endif -# else /* ! JOBS */ -# ifdef CONFIG_ASH_ALIAS -# define COMMANDCMD (builtincmd + 6) -# define EXECCMD (builtincmd + 9) -# else -# define COMMANDCMD (builtincmd + 5) -# define EXECCMD (builtincmd + 8) -# endif -# endif /* JOBS */ -#else /* ! CONFIG_ASH_CMDCMD */ -# ifdef JOBS -# ifdef CONFIG_ASH_ALIAS -# define EXECCMD (builtincmd + 9) -# else -# define EXECCMD (builtincmd + 8) -# endif -# else /* ! JOBS */ -# ifdef CONFIG_ASH_ALIAS -# define EXECCMD (builtincmd + 8) -# else -# define EXECCMD (builtincmd + 7) -# endif -# endif /* JOBS */ -#endif /* CONFIG_ASH_CMDCMD */ #define BUILTIN_NOSPEC "0" #define BUILTIN_SPECIAL "1" @@ -1328,65 +1305,21 @@ #define IS_BUILTIN_REGULAR(builtincmd) ((builtincmd)->name[0] & 2) static const struct builtincmd builtincmd[] = { - { BUILTIN_SPEC_REG ".", dotcmd }, - { BUILTIN_SPEC_REG ":", truecmd }, -#ifdef CONFIG_ASH_ALIAS - { BUILTIN_REG_ASSG "alias", aliascmd }, -#endif -#ifdef JOBS - { BUILTIN_REGULAR "bg", bgcmd }, -#endif - { BUILTIN_SPEC_REG "break", breakcmd }, - { BUILTIN_REGULAR "cd", cdcmd }, - { BUILTIN_NOSPEC "chdir", cdcmd }, -#ifdef CONFIG_ASH_CMDCMD - { BUILTIN_REGULAR "command", commandcmd }, -#endif - { BUILTIN_SPEC_REG "continue", breakcmd }, - { BUILTIN_SPEC_REG "eval", evalcmd }, - { BUILTIN_SPEC_REG "exec", execcmd }, - { BUILTIN_SPEC_REG "exit", exitcmd }, - { BUILTIN_SPEC_REG_ASSG "export", exportcmd }, - { BUILTIN_REGULAR "false", falsecmd }, -#ifdef JOBS - { BUILTIN_REGULAR "fg", fgcmd }, -#endif -#ifdef CONFIG_ASH_GETOPTS - { BUILTIN_REGULAR "getopts", getoptscmd }, -#endif - { BUILTIN_NOSPEC "hash", hashcmd }, -#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET - { BUILTIN_NOSPEC "help", helpcmd }, -#endif -#ifdef JOBS - { BUILTIN_REGULAR "jobs", jobscmd }, - { BUILTIN_REGULAR "kill", killcmd }, -#endif -#ifdef CONFIG_ASH_MATH_SUPPORT - { BUILTIN_NOSPEC "let", letcmd }, -#endif - { BUILTIN_ASSIGN "local", localcmd }, - { BUILTIN_NOSPEC "pwd", pwdcmd }, - { BUILTIN_REGULAR "read", readcmd }, - { BUILTIN_SPEC_REG_ASSG "readonly", exportcmd }, - { BUILTIN_SPEC_REG "return", returncmd }, - { BUILTIN_SPEC_REG "set", setcmd }, - { BUILTIN_SPEC_REG "shift", shiftcmd }, - { BUILTIN_SPEC_REG "times", timescmd }, - { BUILTIN_SPEC_REG "trap", trapcmd }, - { BUILTIN_REGULAR "true", truecmd }, - { BUILTIN_NOSPEC "type", typecmd }, - { BUILTIN_NOSPEC "ulimit", ulimitcmd }, - { BUILTIN_REGULAR "umask", umaskcmd }, -#ifdef CONFIG_ASH_ALIAS - { BUILTIN_REGULAR "unalias", unaliascmd }, -#endif - { BUILTIN_SPEC_REG "unset", unsetcmd }, - { BUILTIN_REGULAR "wait", waitcmd }, +#define BUILTIN_COMMAND_SPEC(code, str, func) {str, func}, +#include "ash.d" +{} }; -#define NUMBUILTINS (sizeof (builtincmd) / sizeof (struct builtincmd) ) +enum { +#define BUILTIN_COMMAND_SPEC(code, str, func) code, +#include "ash.d" +NUMBUILTINS +}; +#ifdef CONFIG_ASH_CMDCMD +#define COMMANDCMD (builtincmd + COMMAND_CMD) +#endif +#define EXECCMD (builtincmd + EXEC_CMD) struct cmdentry { @@ -1678,7 +1611,8 @@ /* from input.c: */ { - basepf.nextc = basepf.buf = basebuf; + struct parsefile* pf = &basepf; + pf->nextc = pf->buf = basebuf; } /* from trap.c: */ @@ -2678,6 +2612,14 @@ * Called to reset things after an exception. */ +#ifdef CONFIG_FEATURE_BUILTIN_ECHO +static int +echocmd(int argc, char **argv) +{ + return echo_main(argc, argv); +} +#endif + /* * The eval commmand. */ @@ -3028,6 +2970,23 @@ } +static int +cat_file(union node *n) +{ +#ifdef CONFIG_ASH_PIPE_OPTIMIZATION + if (n->type == NCMD + && n->ncmd.args != NULL + && strcmp(n->ncmd.args->narg.text, "cat") == 0 + && n->ncmd.args->narg.next != NULL + && *n->ncmd.args->narg.next->narg.text != '-' + && n->ncmd.args->narg.next->narg.next == NULL) + { + return open(n->ncmd.args->narg.next->narg.text, O_RDONLY); + } +#endif + return -1; +} + /* * Evaluate a pipeline. All the processes in the pipeline are children @@ -3057,7 +3016,11 @@ prehash(lp->n); pip[1] = -1; if (lp->next) { - if (pipe(pip) < 0) { + if (prevfd < 0 && (prevfd = cat_file(lp->n)) >= 0) { + // it is cat at the beginning of the pipe + continue; + } + if (pipe(pip) < 0) { close(prevfd); error("Pipe call failed"); } @@ -3104,11 +3067,11 @@ { int saveherefd; - result->fd = -1; + result->fd = cat_file(n); result->buf = NULL; result->nleft = 0; result->jp = NULL; - if (n == NULL) { + if (n == NULL || result->fd >= 0) { goto out; } @@ -3562,6 +3525,24 @@ } } +#ifdef CONFIG_FEATURE_BUILTIN_TEST +static int +testcmd(int argc, char** argv) +{ + bb_applet_name = argv[0]; + return test_main(argc, argv); +} +#endif + +#ifdef CONFIG_FEATURE_BUILTIN_PIDOF +static int +pidofcmd(int argc, char** argv) +{ + bb_applet_name = argv[0]; + return pidof_main(argc, argv); +} +#endif + static int falsecmd(int argc, char **argv) @@ -4943,7 +4924,9 @@ ckfree(in.buf); if (in.fd >= 0) { close(in.fd); - back_exitstatus = waitforjob(in.jp); + if (in.jp != NULL) { + back_exitstatus = waitforjob(in.jp); + } } INTON; @@ -8118,13 +8101,28 @@ if (argc >= 2) { /* That's what SVR2 does */ char *fullname; struct stackmark smark; + struct shparam saveparam; setstackmark(&smark); fullname = find_dot_file(argv[1]); + + if (argc>2) { + saveparam = shellparam; + shellparam.malloc = 0; + shellparam.nparam = argc - 2; + shellparam.p = argv + 2; + } + setinputfile(fullname, 1); commandname = fullname; cmdloop(0); popfile(); + + if (argc>2) { + freeparam(&shellparam); + shellparam = saveparam; + } + popstackmark(&smark); } return exitstatus; diff -Naur busybox-1.00-pre3.orig/shell/ash.d busybox-1.00-pre3/shell/ash.d --- busybox-1.00-pre3.orig/shell/ash.d 1970-01-01 03:00:00.000000000 +0300 +++ busybox-1.00-pre3/shell/ash.d 2003-11-07 17:47:59.000000000 +0300 @@ -0,0 +1,70 @@ +BUILTIN_COMMAND_SPEC(DOT_CMD, BUILTIN_SPEC_REG ".", dotcmd) +BUILTIN_COMMAND_SPEC(COMMA_CMD, BUILTIN_SPEC_REG ":", truecmd) +#ifdef CONFIG_FEATURE_BUILTIN_TEST +BUILTIN_COMMAND_SPEC(RPAR_CMD, BUILTIN_REGULAR "[", testcmd) +#endif +#ifdef CONFIG_ASH_ALIAS +BUILTIN_COMMAND_SPEC(ALIAS_CMD, BUILTIN_REG_ASSG "alias", aliascmd) +#endif +#ifdef JOBS +BUILTIN_COMMAND_SPEC(BG_CMD, BUILTIN_REGULAR "bg", bgcmd) +#endif +BUILTIN_COMMAND_SPEC(BREAK_CMD, BUILTIN_SPEC_REG "break", breakcmd) +BUILTIN_COMMAND_SPEC(CD_CMD, BUILTIN_REGULAR "cd", cdcmd) +BUILTIN_COMMAND_SPEC(CHDIR_CMD, BUILTIN_NOSPEC "chdir", cdcmd) +#ifdef CONFIG_ASH__CMD_CMD +BUILTIN_COMMAND_SPEC(COMMAND_CMD, BUILTIN_REGULAR "command", commandcmd) +#endif +BUILTIN_COMMAND_SPEC(CONTINUE_CMD,BUILTIN_SPEC_REG "continue", breakcmd) +#ifdef CONFIG_FEATURE_BUILTIN_ECHO +BUILTIN_COMMAND_SPEC(ECHO_CMD, BUILTIN_REGULAR "echo", echocmd) +#endif +BUILTIN_COMMAND_SPEC(EVAL_CMD, BUILTIN_SPEC_REG "eval", evalcmd) +BUILTIN_COMMAND_SPEC(EXEC_CMD, BUILTIN_SPEC_REG "exec", execcmd) +BUILTIN_COMMAND_SPEC(EXIT_CMD, BUILTIN_SPEC_REG "exit", exitcmd) +BUILTIN_COMMAND_SPEC(EXPORT_CMD, BUILTIN_SPEC_REG_ASSG "export", exportcmd) +BUILTIN_COMMAND_SPEC(FALSE_CMD, BUILTIN_REGULAR "false", falsecmd) +#ifdef JOBS +BUILTIN_COMMAND_SPEC(FG_CMD, BUILTIN_REGULAR "fg", fgcmd) +#endif +#ifdef CONFIG_ASH_GETOPTS +BUILTIN_COMMAND_SPEC(GETOPTS_CMD, BUILTIN_REGULAR "getopts", getoptscmd) +#endif +BUILTIN_COMMAND_SPEC(HASH_CMD, BUILTIN_NOSPEC "hash", hashcmd) +#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET +BUILTIN_COMMAND_SPEC(HELP_CMD, BUILTIN_NOSPEC "help", helpcmd) +#endif +#ifdef JOBS +BUILTIN_COMMAND_SPEC(JOBS_CMD, BUILTIN_REGULAR "jobs", jobscmd) +BUILTIN_COMMAND_SPEC(KILL_CMD, BUILTIN_REGULAR "kill", killcmd) +#endif +#ifdef CONFIG_ASH_MATH_SUPPORT +BUILTIN_COMMAND_SPEC(LET_CMD, BUILTIN_NOSPEC "let", letcmd) +#endif +BUILTIN_COMMAND_SPEC(LOCAL_CMD, BUILTIN_ASSIGN "local", localcmd) +#ifdef CONFIG_FEATURE_BUILTIN_PIDOF +BUILTIN_COMMAND_SPEC(PIDOF_CMD, BUILTIN_REGULAR "pidof", pidofcmd) +#endif +BUILTIN_COMMAND_SPEC(PWD_CMD, BUILTIN_NOSPEC "pwd", pwdcmd) +BUILTIN_COMMAND_SPEC(READ_CMD, BUILTIN_REGULAR "read", readcmd) +BUILTIN_COMMAND_SPEC(READONLY_CMD,BUILTIN_SPEC_REG_ASSG "readonly", exportcmd) +BUILTIN_COMMAND_SPEC(RETURN_CMD, BUILTIN_SPEC_REG "return", returncmd) +BUILTIN_COMMAND_SPEC(SET_CMD, BUILTIN_SPEC_REG "set", setcmd) +BUILTIN_COMMAND_SPEC(SHIFT_CMD, BUILTIN_SPEC_REG "shift", shiftcmd) +#ifdef CONFIG_FEATURE_BUILTIN_TEST +BUILTIN_COMMAND_SPEC(TEST_CMD, BUILTIN_REGULAR "test", testcmd) +#endif +BUILTIN_COMMAND_SPEC(TIMES_CMD, BUILTIN_SPEC_REG "times", timescmd) +BUILTIN_COMMAND_SPEC(TRAP_CMD, BUILTIN_SPEC_REG "trap", trapcmd) +BUILTIN_COMMAND_SPEC(TRUE_CMD, BUILTIN_REGULAR "true", truecmd) +BUILTIN_COMMAND_SPEC(TYPE_CMD, BUILTIN_NOSPEC "type", typecmd) +BUILTIN_COMMAND_SPEC(ULIMIT_CMD, BUILTIN_NOSPEC "ulimit", ulimitcmd) +BUILTIN_COMMAND_SPEC(UMASK_CMD, BUILTIN_REGULAR "umask", umaskcmd) +#ifdef CONFIG_ASH_ALIAS +BUILTIN_COMMAND_SPEC(UNALIAS_CMD, BUILTIN_REGULAR "unalias", unaliascmd) +#endif +BUILTIN_COMMAND_SPEC(UNSET_CMD, BUILTIN_SPEC_REG "unset", unsetcmd) +BUILTIN_COMMAND_SPEC(WAIT_CMD, BUILTIN_REGULAR "wait", waitcmd) + + +#undef BUILTIN_COMMAND_SPEC diff -Naur busybox-1.00-pre3.orig/util-linux/Config.in busybox-1.00-pre3/util-linux/Config.in --- busybox-1.00-pre3.orig/util-linux/Config.in 2003-08-06 13:07:36.000000000 +0400 +++ busybox-1.00-pre3/util-linux/Config.in 2003-11-07 17:47:35.000000000 +0300 @@ -223,7 +223,7 @@ config CONFIG_MKSWAP bool "mkswap" - default n + default y help The mkswap utility is used to configure a file or disk partition as Linux swap space. This allows Linux to use the entire file or @@ -275,7 +275,7 @@ config CONFIG_SWAPONOFF bool "swaponoff" - default n + default y help This option enables both the 'swapon' and the 'swapoff' utilities. Once you have created some swap space using 'mkswap', you also need