shell: remove lash and bbsh
authorDenys Vlasenko <dvlasenk@redhat.com>
Mon, 6 Sep 2010 08:18:21 +0000 (10:18 +0200)
committerDenys Vlasenko <dvlasenk@redhat.com>
Mon, 6 Sep 2010 08:18:21 +0000 (10:18 +0200)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
TEST_config_nommu
TEST_config_noprintf
TEST_config_rh9
TODO
include/applets.src.h
shell/bbsh.c [deleted file]
shell/hush.c

index 911f02f..18f4483 100644 (file)
@@ -904,7 +904,6 @@ CONFIG_HUSH_FUNCTIONS=y
 CONFIG_HUSH_LOCAL=y
 CONFIG_HUSH_EXPORT_N=y
 CONFIG_HUSH_RANDOM_SUPPORT=y
-CONFIG_LASH=y
 CONFIG_MSH=y
 CONFIG_SH_MATH_SUPPORT=y
 CONFIG_SH_MATH_SUPPORT_64=y
index ba003a1..22525ec 100644 (file)
@@ -904,7 +904,6 @@ CONFIG_FEATURE_SH_IS_NONE=y
 # CONFIG_FEATURE_BASH_IS_ASH is not set
 # CONFIG_FEATURE_BASH_IS_HUSH is not set
 CONFIG_FEATURE_BASH_IS_NONE=y
-# CONFIG_LASH is not set
 # CONFIG_MSH is not set
 # CONFIG_SH_MATH_SUPPORT is not set
 # CONFIG_SH_MATH_SUPPORT_64 is not set
index 3ffb1c6..e456083 100644 (file)
@@ -918,7 +918,6 @@ CONFIG_HUSH_FUNCTIONS=y
 CONFIG_HUSH_LOCAL=y
 CONFIG_HUSH_EXPORT_N=y
 CONFIG_HUSH_RANDOM_SUPPORT=y
-# CONFIG_LASH is not set
 CONFIG_MSH=y
 CONFIG_SH_MATH_SUPPORT=y
 CONFIG_SH_MATH_SUPPORT_64=y
diff --git a/TODO b/TODO
index 6f8cd8a..8b9f87f 100644 (file)
--- a/TODO
+++ b/TODO
@@ -82,7 +82,7 @@ Rob Landley suggested this:
 
   initramfs
     Busybox should have a sample initramfs build script.  This depends on
-    bbsh, mdev, and switch_root.
+    shell, mdev, and switch_root.
 
   mkdep
     Write a mkdep that doesn't segfault if there's a directory it doesn't
index 195598f..0e4f966 100644 (file)
@@ -75,7 +75,6 @@ IF_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_DROP))
 IF_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_DROP, awk))
 IF_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_DROP, basename))
 IF_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_DROP))
-//IF_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_DROP))
 IF_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _BB_SUID_DROP))
 IF_BLKID(APPLET(blkid, _BB_DIR_SBIN, _BB_SUID_DROP))
 IF_BOOTCHARTD(APPLET(bootchartd, _BB_DIR_SBIN, _BB_SUID_DROP))
diff --git a/shell/bbsh.c b/shell/bbsh.c
deleted file mode 100644 (file)
index 8e25db4..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/* vi: set ts=4 :
- *
- * bbsh - busybox shell
- *
- * Copyright 2006 Rob Landley <rob@landley.net>
- *
- * Licensed under GPLv2 or later, see file LICENSE in this source tree.
- */
-
-// A section of code that gets repeatedly or conditionally executed is stored
-// as a string and parsed each time it's run.
-
-
-
-// Wheee, debugging.
-
-// Terminal control
-#define ENABLE_BBSH_TTY        0
-
-// &, fg, bg, jobs.  (ctrl-z with tty.)
-#define ENABLE_BBSH_JOBCTL     0
-
-// Flow control (if, while, for, functions { })
-#define ENABLE_BBSH_FLOWCTL    0
-
-#define ENABLE_BBSH_ENVVARS    0  // Environment variable support
-
-// Local and synthetic variables, fancy prompts, set, $?, etc.
-#define ENABLE_BBSH_LOCALVARS  0
-
-// Pipes and redirects: | > < >> << && || & () ;
-#define ENABLE_BBSH_PIPES      0
-
-/* Fun:
-
-  echo `echo hello#comment " woot` and more
-*/
-
-#include "libbb.h"
-
-// A single executable, its arguments, and other information we know about it.
-#define BBSH_FLAG_EXIT    1
-#define BBSH_FLAG_SUSPEND 2
-#define BBSH_FLAG_PIPE    4
-#define BBSH_FLAG_AND     8
-#define BBSH_FLAG_OR      16
-#define BBSH_FLAG_AMP     32
-#define BBSH_FLAG_SEMI    64
-#define BBSH_FLAG_PAREN   128
-
-// What we know about a single process.
-struct command {
-       struct command *next;
-       int flags;              // exit, suspend, && ||
-       int pid;                // pid (or exit code)
-       int argc;
-       char *argv[];
-};
-
-// A collection of processes piped into/waiting on each other.
-struct pipeline {
-       struct pipeline *next;
-       int job_id;
-       struct command *cmd;
-       char *cmdline;
-       int cmdlinelen;
-};
-
-static void free_list(void *list, void (*freeit)(void *data))
-{
-       while (list) {
-               void **next = (void **)list;
-               void *list_next = *next;
-               freeit(list);
-               free(list);
-               list = list_next;
-       }
-}
-
-// Parse one word from the command line, appending one or more argv[] entries
-// to struct command.  Handles environment variable substitution and
-// substrings.  Returns pointer to next used byte, or NULL if it
-// hit an ending token.
-static char *parse_word(char *start, struct command **cmd)
-{
-       char *end;
-
-       // Detect end of line (and truncate line at comment)
-       if (ENABLE_BBSH_PIPES && strchr("><&|(;", *start)) return 0;
-
-       // Grab next word.  (Add dequote and envvar logic here)
-       end = start;
-       end = skip_non_whitespace(end);
-       (*cmd)->argv[(*cmd)->argc++] = xstrndup(start, end-start);
-
-       // Allocate more space if there's no room for NULL terminator.
-
-       if (!((*cmd)->argc & 7))
-                       *cmd = xrealloc(*cmd,
-                                       sizeof(struct command) + ((*cmd)->argc+8)*sizeof(char *));
-       (*cmd)->argv[(*cmd)->argc] = 0;
-       return end;
-}
-
-// Parse a line of text into a pipeline.
-// Returns a pointer to the next line.
-
-static char *parse_pipeline(char *cmdline, struct pipeline *line)
-{
-       struct command **cmd = &(line->cmd);
-       char *start = line->cmdline = cmdline;
-
-       if (!cmdline) return 0;
-
-       if (ENABLE_BBSH_JOBCTL) line->cmdline = cmdline;
-
-       // Parse command into argv[]
-       for (;;) {
-               char *end;
-
-               // Skip leading whitespace and detect end of line.
-               start = skip_whitespace(start);
-               if (!*start || *start=='#') {
-                       if (ENABLE_BBSH_JOBCTL) line->cmdlinelen = start-cmdline;
-                       return 0;
-               }
-
-               // Allocate next command structure if necessary
-               if (!*cmd) *cmd = xzalloc(sizeof(struct command)+8*sizeof(char *));
-
-               // Parse next argument and add the results to argv[]
-               end = parse_word(start, cmd);
-
-               // If we hit the end of this command, how did it end?
-               if (!end) {
-                       if (ENABLE_BBSH_PIPES && *start) {
-                               if (*start==';') {
-                                       start++;
-                                       break;
-                               }
-                               // handle | & < > >> << || &&
-                       }
-                       break;
-               }
-               start = end;
-       }
-
-       if (ENABLE_BBSH_JOBCTL) line->cmdlinelen = start-cmdline;
-
-       return start;
-}
-
-// Execute the commands in a pipeline
-static int run_pipeline(struct pipeline *line)
-{
-       struct command *cmd = line->cmd;
-       if (!cmd || !cmd->argc) return 0;
-
-       // Handle local commands.  This is totally fake and plastic.
-       if (cmd->argc==2 && !strcmp(cmd->argv[0],"cd"))
-               chdir(cmd->argv[1]);
-       else if (!strcmp(cmd->argv[0],"exit"))
-               exit(cmd->argc>1 ? atoi(cmd->argv[1]) : 0);
-       else {
-               int status;
-               pid_t pid=fork();
-               if (!pid) {
-                       run_applet_and_exit(cmd->argv[0],cmd->argc,cmd->argv);
-                       execvp(cmd->argv[0],cmd->argv);
-                       printf("No %s", cmd->argv[0]);
-                       exit(EXIT_FAILURE);
-               } else waitpid(pid, &status, 0);
-       }
-
-       return 0;
-}
-
-static void free_cmd(void *data)
-{
-       struct command *cmd=(struct command *)data;
-
-       while (cmd->argc) free(cmd->argv[--cmd->argc]);
-}
-
-
-static void handle(char *command)
-{
-       struct pipeline line;
-       char *start = command;
-
-       for (;;) {
-               memset(&line,0,sizeof(struct pipeline));
-               start = parse_pipeline(start, &line);
-               if (!line.cmd) break;
-
-               run_pipeline(&line);
-               free_list(line.cmd, free_cmd);
-       }
-}
-
-int bbsh_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int bbsh_main(int argc UNUSED_PARAM, char **argv)
-{
-       char *command=NULL;
-       FILE *f;
-
-       getopt32(argv, "c:", &command);
-
-       f = argv[optind] ? xfopen_for_read(argv[optind]) : NULL;
-       if (command) handle(command);
-       else {
-               unsigned cmdlen=0;
-               for (;;) {
-                       if (!f) putchar('$');
-                       if (1 > getline(&command, &cmdlen, f ? f : stdin)) break;
-
-                       handle(command);
-               }
-               if (ENABLE_FEATURE_CLEAN_UP) free(command);
-       }
-
-       return 1;
-}
index 2afe12f..81811cb 100644 (file)
 
 //applet:IF_HUSH(APPLET(hush, _BB_DIR_BIN, _BB_SUID_DROP))
 //applet:IF_MSH(APPLET(msh, _BB_DIR_BIN, _BB_SUID_DROP))
-//applet:IF_LASH(APPLET(lash, _BB_DIR_BIN, _BB_SUID_DROP))
 //applet:IF_FEATURE_SH_IS_HUSH(APPLET_ODDNAME(sh, hush, _BB_DIR_BIN, _BB_SUID_DROP, sh))
 //applet:IF_FEATURE_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, _BB_DIR_BIN, _BB_SUID_DROP, bash))
 
 //config:        This instructs hush to print commands before execution.
 //config:        Adds ~300 bytes.
 //config:
-//config:config LASH
-//config:      bool "lash (deprecated: aliased to hush)"
-//config:      default n
-//config:      select HUSH
-//config:      help
-//config:        lash is deprecated and will be removed, please migrate to hush.
-//config:
 //config:config MSH
 //config:      bool "msh (deprecated: aliased to hush)"
 //config:      default n
 
 //usage:#define hush_trivial_usage NOUSAGE_STR
 //usage:#define hush_full_usage ""
-//usage:#define lash_trivial_usage NOUSAGE_STR
-//usage:#define lash_full_usage ""
 //usage:#define msh_trivial_usage NOUSAGE_STR
 //usage:#define msh_full_usage ""
 
@@ -7732,15 +7722,6 @@ int hush_main(int argc, char **argv)
 }
 
 
-#if ENABLE_LASH
-int lash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int lash_main(int argc, char **argv)
-{
-       bb_error_msg("lash is deprecated, please use hush instead");
-       return hush_main(argc, argv);
-}
-#endif
-
 #if ENABLE_MSH
 int msh_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int msh_main(int argc, char **argv)