aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-10-24 05:00:29 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-10-24 05:00:29 +0000
commit1e2799601614452a40df7862e6ca180ecb08c04d (patch)
tree153a573095afac8d8d0ea857759ecabd77fb28b7 /shell
parent47f91d1f7fc06cf27e2a6c3c2ada99226ba50cb9 (diff)
downloadbusybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.tar.gz
busybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.tar.bz2
busybox-w32-1e2799601614452a40df7862e6ca180ecb08c04d.zip
Major rework of the directory structure and the entire build system.
-Erik git-svn-id: svn://busybox.net/trunk/busybox@3561 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'shell')
-rw-r--r--shell/Makefile40
-rw-r--r--shell/ash.c34
-rw-r--r--shell/cmdedit.c94
-rw-r--r--shell/config.in51
-rw-r--r--shell/hush.c21
-rw-r--r--shell/lash.c38
-rw-r--r--shell/msh.c26
7 files changed, 199 insertions, 105 deletions
diff --git a/shell/Makefile b/shell/Makefile
new file mode 100644
index 000000000..e0229973e
--- /dev/null
+++ b/shell/Makefile
@@ -0,0 +1,40 @@
1# Makefile for busybox
2#
3# Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2 of the License, or
8# (at your option) any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software
17# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18#
19
20TOPDIR :=..
21L_TARGET := shell.a
22EXTRA_CFLAGS = -DBB_VER='"$(VERSION)"' -DBB_BT='"$(BUILDTIME)"'
23
24obj-y :=
25obj-n :=
26obj- :=
27
28obj-$(CONFIG_ASH) += ash.o
29obj-$(CONFIG_HUSH) += hush.o
30obj-$(CONFIG_LASH) += lash.o
31obj-$(CONFIG_MSH) += msh.o
32obj-$(CONFIG_FEATURE_COMMAND_EDITING) += cmdedit.o
33
34
35# Hand off to toplevel Rules.mak
36include $(TOPDIR)/Rules.mak
37
38clean:
39 rm -f $(L_TARGET) *.o core
40
diff --git a/shell/ash.c b/shell/ash.c
index 486386a25..9cc2208ab 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -265,7 +265,7 @@ union align {
265#define ALIGN(nbytes) (((nbytes) + sizeof(union align) - 1) & ~(sizeof(union align) - 1)) 265#define ALIGN(nbytes) (((nbytes) + sizeof(union align) - 1) & ~(sizeof(union align) - 1))
266#endif 266#endif
267 267
268#ifdef BB_LOCALE_SUPPORT 268#ifdef CONFIG_LOCALE_SUPPORT
269#include <locale.h> 269#include <locale.h>
270static void change_lc_all(const char *value); 270static void change_lc_all(const char *value);
271static void change_lc_ctype(const char *value); 271static void change_lc_ctype(const char *value);
@@ -1218,7 +1218,7 @@ static struct var vpath;
1218static struct var vps1; 1218static struct var vps1;
1219static struct var vps2; 1219static struct var vps2;
1220static struct var voptind; 1220static struct var voptind;
1221#ifdef BB_LOCALE_SUPPORT 1221#ifdef CONFIG_LOCALE_SUPPORT
1222static struct var vlc_all; 1222static struct var vlc_all;
1223static struct var vlc_ctype; 1223static struct var vlc_ctype;
1224#endif 1224#endif
@@ -1261,7 +1261,7 @@ static const struct varinit varinit[] = {
1261 NULL }, 1261 NULL },
1262 { &voptind, VSTRFIXED|VTEXTFIXED, "OPTIND=1", 1262 { &voptind, VSTRFIXED|VTEXTFIXED, "OPTIND=1",
1263 getoptsreset }, 1263 getoptsreset },
1264#ifdef BB_LOCALE_SUPPORT 1264#ifdef CONFIG_LOCALE_SUPPORT
1265 { &vlc_all, VSTRFIXED|VTEXTFIXED|VUNSET, "LC_ALL=", 1265 { &vlc_all, VSTRFIXED|VTEXTFIXED|VUNSET, "LC_ALL=",
1266 change_lc_all }, 1266 change_lc_all },
1267 { &vlc_ctype, VSTRFIXED|VTEXTFIXED|VUNSET, "LC_CTYPE=", 1267 { &vlc_ctype, VSTRFIXED|VTEXTFIXED|VUNSET, "LC_CTYPE=",
@@ -1556,7 +1556,7 @@ static int hashcmd (int, char **);
1556static int helpcmd (int, char **); 1556static int helpcmd (int, char **);
1557static int jobscmd (int, char **); 1557static int jobscmd (int, char **);
1558static int localcmd (int, char **); 1558static int localcmd (int, char **);
1559#ifndef BB_PWD 1559#ifndef CONFIG_PWD
1560static int pwdcmd (int, char **); 1560static int pwdcmd (int, char **);
1561#endif 1561#endif
1562static int readcmd (int, char **); 1562static int readcmd (int, char **);
@@ -1582,7 +1582,7 @@ static int typecmd (int, char **);
1582static int getoptscmd (int, char **); 1582static int getoptscmd (int, char **);
1583#endif 1583#endif
1584 1584
1585#ifndef BB_TRUE_FALSE 1585#ifndef CONFIG_TRUE_FALSE
1586static int true_main (int, char **); 1586static int true_main (int, char **);
1587static int false_main (int, char **); 1587static int false_main (int, char **);
1588#endif 1588#endif
@@ -1653,7 +1653,7 @@ static const struct builtincmd builtincmds[] = {
1653 { BUILTIN_REGULAR "let", letcmd }, 1653 { BUILTIN_REGULAR "let", letcmd },
1654#endif 1654#endif
1655 { BUILTIN_ASSIGN "local", localcmd }, 1655 { BUILTIN_ASSIGN "local", localcmd },
1656#ifndef BB_PWD 1656#ifndef CONFIG_PWD
1657 { BUILTIN_NOSPEC "pwd", pwdcmd }, 1657 { BUILTIN_NOSPEC "pwd", pwdcmd },
1658#endif 1658#endif
1659 { BUILTIN_REGULAR "read", readcmd }, 1659 { BUILTIN_REGULAR "read", readcmd },
@@ -1938,7 +1938,7 @@ updatepwd(const char *dir)
1938} 1938}
1939 1939
1940 1940
1941#ifndef BB_PWD 1941#ifndef CONFIG_PWD
1942static int 1942static int
1943pwdcmd(argc, argv) 1943pwdcmd(argc, argv)
1944 int argc; 1944 int argc;
@@ -3182,7 +3182,7 @@ returncmd(argc, argv)
3182} 3182}
3183 3183
3184 3184
3185#ifndef BB_TRUE_FALSE 3185#ifndef CONFIG_TRUE_FALSE
3186static int 3186static int
3187false_main(argc, argv) 3187false_main(argc, argv)
3188 int argc; 3188 int argc;
@@ -3224,7 +3224,7 @@ setinteractive(int on)
3224 is_interactive = on; 3224 is_interactive = on;
3225 if (do_banner==0 && is_interactive) { 3225 if (do_banner==0 && is_interactive) {
3226 /* Looks like they want an interactive shell */ 3226 /* Looks like they want an interactive shell */
3227#ifndef BB_FEATURE_SH_EXTRA_QUIET 3227#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET
3228 printf( "\n\n" BB_BANNER " Built-in shell (ash)\n"); 3228 printf( "\n\n" BB_BANNER " Built-in shell (ash)\n");
3229 printf( "Enter 'help' for a list of built-in commands.\n\n"); 3229 printf( "Enter 'help' for a list of built-in commands.\n\n");
3230#endif 3230#endif
@@ -3535,11 +3535,11 @@ tryexec(char *cmd, char **argv, char **envp)
3535{ 3535{
3536 int e; 3536 int e;
3537 3537
3538#ifdef BB_FEATURE_SH_STANDALONE_SHELL 3538#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
3539 char *name = cmd; 3539 char *name = cmd;
3540 char** argv_l=argv; 3540 char** argv_l=argv;
3541 int argc_l; 3541 int argc_l;
3542#ifdef BB_FEATURE_SH_APPLETS_ALWAYS_WIN 3542#ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
3543 name = get_last_path_component(name); 3543 name = get_last_path_component(name);
3544#endif 3544#endif
3545 argv_l=envp; 3545 argv_l=envp;
@@ -3766,7 +3766,7 @@ static int helpcmd(int argc, char** argv)
3766 col = 0; 3766 col = 0;
3767 } 3767 }
3768 } 3768 }
3769#ifdef BB_FEATURE_SH_STANDALONE_SHELL 3769#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
3770 { 3770 {
3771 extern const struct BB_applet applets[]; 3771 extern const struct BB_applet applets[];
3772 extern const size_t NUM_APPLETS; 3772 extern const size_t NUM_APPLETS;
@@ -6023,7 +6023,7 @@ reset(void) {
6023 * This file implements the input routines used by the parser. 6023 * This file implements the input routines used by the parser.
6024 */ 6024 */
6025 6025
6026#ifdef BB_FEATURE_COMMAND_EDITING 6026#ifdef CONFIG_FEATURE_COMMAND_EDITING
6027static const char * cmdedit_prompt; 6027static const char * cmdedit_prompt;
6028static inline void putprompt(const char *s) { 6028static inline void putprompt(const char *s) {
6029 cmdedit_prompt = s; 6029 cmdedit_prompt = s;
@@ -6090,7 +6090,7 @@ preadfd(void)
6090 parsenextc = buf; 6090 parsenextc = buf;
6091 6091
6092retry: 6092retry:
6093#ifdef BB_FEATURE_COMMAND_EDITING 6093#ifdef CONFIG_FEATURE_COMMAND_EDITING
6094 { 6094 {
6095 if (!iflag || parsefile->fd) 6095 if (!iflag || parsefile->fd)
6096 nr = safe_read(parsefile->fd, buf, BUFSIZ - 1); 6096 nr = safe_read(parsefile->fd, buf, BUFSIZ - 1);
@@ -7718,7 +7718,7 @@ ash_main(argc, argv)
7718 EXECCMD = find_builtin("exec"); 7718 EXECCMD = find_builtin("exec");
7719 EVALCMD = find_builtin("eval"); 7719 EVALCMD = find_builtin("eval");
7720 7720
7721#ifndef BB_FEATURE_SH_FANCY_PROMPT 7721#ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
7722 unsetenv("PS1"); 7722 unsetenv("PS1");
7723 unsetenv("PS2"); 7723 unsetenv("PS2");
7724#endif 7724#endif
@@ -9331,7 +9331,7 @@ getoptsreset(const char *value)
9331 shellparam.optoff = -1; 9331 shellparam.optoff = -1;
9332} 9332}
9333 9333
9334#ifdef BB_LOCALE_SUPPORT 9334#ifdef CONFIG_LOCALE_SUPPORT
9335static void change_lc_all(const char *value) 9335static void change_lc_all(const char *value)
9336{ 9336{
9337 if(value != 0 && *value != 0) 9337 if(value != 0 && *value != 0)
@@ -12730,7 +12730,7 @@ findvar(struct var **vpp, const char *name)
12730/* 12730/*
12731 * Copyright (c) 1999 Herbert Xu <herbert@debian.org> 12731 * Copyright (c) 1999 Herbert Xu <herbert@debian.org>
12732 * This file contains code for the times builtin. 12732 * This file contains code for the times builtin.
12733 * $Id: ash.c,v 1.28 2001/10/19 00:22:22 andersen Exp $ 12733 * $Id: ash.c,v 1.29 2001/10/24 05:00:16 andersen Exp $
12734 */ 12734 */
12735static int timescmd (int argc, char **argv) 12735static int timescmd (int argc, char **argv)
12736{ 12736{
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 16ec2f823..d1b9111ea 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -43,7 +43,7 @@
43 43
44#include "busybox.h" 44#include "busybox.h"
45 45
46#ifdef BB_LOCALE_SUPPORT 46#ifdef CONFIG_LOCALE_SUPPORT
47#define Isprint(c) isprint((c)) 47#define Isprint(c) isprint((c))
48#else 48#else
49#define Isprint(c) ( (c) >= ' ' && (c) != ((unsigned char)'\233') ) 49#define Isprint(c) ( (c) >= ' ' && (c) != ((unsigned char)'\233') )
@@ -55,32 +55,32 @@
55 55
56#else 56#else
57 57
58#define BB_FEATURE_COMMAND_EDITING 58#define CONFIG_FEATURE_COMMAND_EDITING
59#define BB_FEATURE_COMMAND_TAB_COMPLETION 59#define CONFIG_FEATURE_COMMAND_TAB_COMPLETION
60#define BB_FEATURE_COMMAND_USERNAME_COMPLETION 60#define CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION
61#define BB_FEATURE_NONPRINTABLE_INVERSE_PUT 61#define CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT
62#define BB_FEATURE_CLEAN_UP 62#define CONFIG_FEATURE_CLEAN_UP
63 63
64#define D(x) x 64#define D(x) x
65 65
66#endif /* TEST */ 66#endif /* TEST */
67 67
68#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION 68#ifdef CONFIG_FEATURE_COMMAND_TAB_COMPLETION
69#include <dirent.h> 69#include <dirent.h>
70#include <sys/stat.h> 70#include <sys/stat.h>
71#endif 71#endif
72 72
73#ifdef BB_FEATURE_COMMAND_EDITING 73#ifdef CONFIG_FEATURE_COMMAND_EDITING
74 74
75#ifndef BB_FEATURE_COMMAND_TAB_COMPLETION 75#ifndef CONFIG_FEATURE_COMMAND_TAB_COMPLETION
76#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION 76#undef CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION
77#endif 77#endif
78 78
79#if defined(BB_FEATURE_COMMAND_USERNAME_COMPLETION) || defined(BB_FEATURE_SH_FANCY_PROMPT) 79#if defined(CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION) || defined(CONFIG_FEATURE_SH_FANCY_PROMPT)
80#define BB_FEATURE_GETUSERNAME_AND_HOMEDIR 80#define CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR
81#endif 81#endif
82 82
83#ifdef BB_FEATURE_GETUSERNAME_AND_HOMEDIR 83#ifdef CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR
84# ifndef TEST 84# ifndef TEST
85# include "pwd_grp/pwd.h" 85# include "pwd_grp/pwd.h"
86# else 86# else
@@ -136,33 +136,33 @@ static int cursor; /* required global for signal handler */
136static int len; /* --- "" - - "" - -"- --""-- --""--- */ 136static int len; /* --- "" - - "" - -"- --""-- --""--- */
137static char *command_ps; /* --- "" - - "" - -"- --""-- --""--- */ 137static char *command_ps; /* --- "" - - "" - -"- --""-- --""--- */
138static 138static
139#ifndef BB_FEATURE_SH_FANCY_PROMPT 139#ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
140 const 140 const
141#endif 141#endif
142char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */ 142char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */
143 143
144#ifdef BB_FEATURE_GETUSERNAME_AND_HOMEDIR 144#ifdef CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR
145static char *user_buf = ""; 145static char *user_buf = "";
146static char *home_pwd_buf = ""; 146static char *home_pwd_buf = "";
147static int my_euid; 147static int my_euid;
148#endif 148#endif
149 149
150#ifdef BB_FEATURE_SH_FANCY_PROMPT 150#ifdef CONFIG_FEATURE_SH_FANCY_PROMPT
151static char *hostname_buf = ""; 151static char *hostname_buf = "";
152static int num_ok_lines = 1; 152static int num_ok_lines = 1;
153#endif 153#endif
154 154
155 155
156#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION 156#ifdef CONFIG_FEATURE_COMMAND_TAB_COMPLETION
157 157
158#ifndef BB_FEATURE_GETUSERNAME_AND_HOMEDIR 158#ifndef CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR
159static int my_euid; 159static int my_euid;
160#endif 160#endif
161 161
162static int my_uid; 162static int my_uid;
163static int my_gid; 163static int my_gid;
164 164
165#endif /* BB_FEATURE_COMMAND_TAB_COMPLETION */ 165#endif /* CONFIG_FEATURE_COMMAND_TAB_COMPLETION */
166 166
167/* It seems that libc5 doesn't know what a sighandler_t is... */ 167/* It seems that libc5 doesn't know what a sighandler_t is... */
168#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1) 168#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
@@ -207,7 +207,7 @@ static void cmdedit_reset_term(void)
207 handlers_sets &= ~SET_WCHG_HANDLERS; 207 handlers_sets &= ~SET_WCHG_HANDLERS;
208 } 208 }
209 fflush(stdout); 209 fflush(stdout);
210#ifdef BB_FEATURE_CLEAN_UP 210#ifdef CONFIG_FEATURE_CLEAN_UP
211 if (his_front) { 211 if (his_front) {
212 struct history *n; 212 struct history *n;
213 213
@@ -230,7 +230,7 @@ static void cmdedit_set_out_char(int next_char)
230 230
231 if (c == 0) 231 if (c == 0)
232 c = ' '; /* destroy end char? */ 232 c = ' '; /* destroy end char? */
233#ifdef BB_FEATURE_NONPRINTABLE_INVERSE_PUT 233#ifdef CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT
234 if (!Isprint(c)) { /* Inverse put non-printable characters */ 234 if (!Isprint(c)) { /* Inverse put non-printable characters */
235 if (c >= 128) 235 if (c >= 128)
236 c -= 128; 236 c -= 128;
@@ -321,7 +321,7 @@ static void put_prompt(void)
321 cmdedit_y = 0; /* new quasireal y */ 321 cmdedit_y = 0; /* new quasireal y */
322} 322}
323 323
324#ifndef BB_FEATURE_SH_FANCY_PROMPT 324#ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
325static void parse_prompt(const char *prmt_ptr) 325static void parse_prompt(const char *prmt_ptr)
326{ 326{
327 cmdedit_prompt = prmt_ptr; 327 cmdedit_prompt = prmt_ptr;
@@ -359,7 +359,7 @@ static void parse_prompt(const char *prmt_ptr)
359 break; 359 break;
360 c = *prmt_ptr++; 360 c = *prmt_ptr++;
361 switch (c) { 361 switch (c) {
362#ifdef BB_FEATURE_GETUSERNAME_AND_HOMEDIR 362#ifdef CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR
363 case 'u': 363 case 'u':
364 pbuf = user_buf; 364 pbuf = user_buf;
365 break; 365 break;
@@ -382,7 +382,7 @@ static void parse_prompt(const char *prmt_ptr)
382 case '$': 382 case '$':
383 c = my_euid == 0 ? '#' : '$'; 383 c = my_euid == 0 ? '#' : '$';
384 break; 384 break;
385#ifdef BB_FEATURE_GETUSERNAME_AND_HOMEDIR 385#ifdef CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR
386 case 'w': 386 case 'w':
387 pbuf = pwd_buf; 387 pbuf = pwd_buf;
388 l = strlen(home_pwd_buf); 388 l = strlen(home_pwd_buf);
@@ -526,7 +526,7 @@ static void cmdedit_init(void)
526 } 526 }
527 527
528 if ((handlers_sets & SET_ATEXIT) == 0) { 528 if ((handlers_sets & SET_ATEXIT) == 0) {
529#ifdef BB_FEATURE_GETUSERNAME_AND_HOMEDIR 529#ifdef CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR
530 struct passwd *entry; 530 struct passwd *entry;
531 531
532 my_euid = geteuid(); 532 my_euid = geteuid();
@@ -537,20 +537,20 @@ static void cmdedit_init(void)
537 } 537 }
538#endif 538#endif
539 539
540#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION 540#ifdef CONFIG_FEATURE_COMMAND_TAB_COMPLETION
541 541
542#ifndef BB_FEATURE_GETUSERNAME_AND_HOMEDIR 542#ifndef CONFIG_FEATURE_GETUSERNAME_AND_HOMEDIR
543 my_euid = geteuid(); 543 my_euid = geteuid();
544#endif 544#endif
545 my_uid = getuid(); 545 my_uid = getuid();
546 my_gid = getgid(); 546 my_gid = getgid();
547#endif /* BB_FEATURE_COMMAND_TAB_COMPLETION */ 547#endif /* CONFIG_FEATURE_COMMAND_TAB_COMPLETION */
548 handlers_sets |= SET_ATEXIT; 548 handlers_sets |= SET_ATEXIT;
549 atexit(cmdedit_reset_term); /* be sure to do this only once */ 549 atexit(cmdedit_reset_term); /* be sure to do this only once */
550 } 550 }
551} 551}
552 552
553#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION 553#ifdef CONFIG_FEATURE_COMMAND_TAB_COMPLETION
554 554
555static int is_execute(const struct stat *st) 555static int is_execute(const struct stat *st)
556{ 556{
@@ -561,7 +561,7 @@ static int is_execute(const struct stat *st)
561 return FALSE; 561 return FALSE;
562} 562}
563 563
564#ifdef BB_FEATURE_COMMAND_USERNAME_COMPLETION 564#ifdef CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION
565 565
566static char **username_tab_completion(char *ud, int *num_matches) 566static char **username_tab_completion(char *ud, int *num_matches)
567{ 567{
@@ -623,7 +623,7 @@ static char **username_tab_completion(char *ud, int *num_matches)
623 return (matches); 623 return (matches);
624 } 624 }
625} 625}
626#endif /* BB_FEATURE_COMMAND_USERNAME_COMPLETION */ 626#endif /* CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION */
627 627
628enum { 628enum {
629 FIND_EXE_ONLY = 0, 629 FIND_EXE_ONLY = 0,
@@ -720,7 +720,7 @@ static char **exe_n_cwd_tab_completion(char *command, int *num_matches,
720 strcpy(dirbuf, command); 720 strcpy(dirbuf, command);
721 /* set dir only */ 721 /* set dir only */
722 dirbuf[(pfind - command) + 1] = 0; 722 dirbuf[(pfind - command) + 1] = 0;
723#ifdef BB_FEATURE_COMMAND_USERNAME_COMPLETION 723#ifdef CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION
724 if (dirbuf[0] == '~') /* ~/... or ~user/... */ 724 if (dirbuf[0] == '~') /* ~/... or ~user/... */
725 username_tab_completion(dirbuf, 0); 725 username_tab_completion(dirbuf, 0);
726#endif 726#endif
@@ -826,12 +826,12 @@ static int find_match(char *matchBuf, int *len_with_quotes)
826 collapse_pos(j, j + 1); 826 collapse_pos(j, j + 1);
827 int_buf[j] |= QUOT; 827 int_buf[j] |= QUOT;
828 i++; 828 i++;
829#ifdef BB_FEATURE_NONPRINTABLE_INVERSE_PUT 829#ifdef CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT
830 if (matchBuf[i] == '\t') /* algorithm equivalent */ 830 if (matchBuf[i] == '\t') /* algorithm equivalent */
831 int_buf[j] = ' ' | QUOT; 831 int_buf[j] = ' ' | QUOT;
832#endif 832#endif
833 } 833 }
834#ifdef BB_FEATURE_NONPRINTABLE_INVERSE_PUT 834#ifdef CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT
835 else if (matchBuf[i] == '\t') 835 else if (matchBuf[i] == '\t')
836 int_buf[j] = ' '; 836 int_buf[j] = ' ';
837#endif 837#endif
@@ -1000,7 +1000,7 @@ static void input_tab(int *lastWasTab)
1000 /* Free up any memory already allocated */ 1000 /* Free up any memory already allocated */
1001 input_tab(0); 1001 input_tab(0);
1002 1002
1003#ifdef BB_FEATURE_COMMAND_USERNAME_COMPLETION 1003#ifdef CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION
1004 /* If the word starts with `~' and there is no slash in the word, 1004 /* If the word starts with `~' and there is no slash in the word,
1005 * then try completing this word as a username. */ 1005 * then try completing this word as a username. */
1006 1006
@@ -1119,7 +1119,7 @@ static void input_tab(int *lastWasTab)
1119 } 1119 }
1120 } 1120 }
1121} 1121}
1122#endif /* BB_FEATURE_COMMAND_TAB_COMPLETION */ 1122#endif /* CONFIG_FEATURE_COMMAND_TAB_COMPLETION */
1123 1123
1124static void get_previous_history(struct history **hp, struct history *p) 1124static void get_previous_history(struct history **hp, struct history *p)
1125{ 1125{
@@ -1232,7 +1232,7 @@ int cmdedit_read_input(char *prompt, char command[BUFSIZ])
1232 * if the len=0 and no chars to delete */ 1232 * if the len=0 and no chars to delete */
1233 if (len == 0) { 1233 if (len == 0) {
1234prepare_to_die: 1234prepare_to_die:
1235#if !defined(BB_ASH) 1235#if !defined(CONFIG_ASH)
1236 printf("exit"); 1236 printf("exit");
1237 goto_new_line(); 1237 goto_new_line();
1238 /* cmdedit_reset_term() called in atexit */ 1238 /* cmdedit_reset_term() called in atexit */
@@ -1259,7 +1259,7 @@ prepare_to_die:
1259 input_backspace(); 1259 input_backspace();
1260 break; 1260 break;
1261 case '\t': 1261 case '\t':
1262#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION 1262#ifdef CONFIG_FEATURE_COMMAND_TAB_COMPLETION
1263 input_tab(&lastWasTab); 1263 input_tab(&lastWasTab);
1264#endif 1264#endif
1265 break; 1265 break;
@@ -1299,7 +1299,7 @@ prepare_to_die:
1299 goto prepare_to_die; 1299 goto prepare_to_die;
1300 } 1300 }
1301 switch (c) { 1301 switch (c) {
1302#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION 1302#ifdef CONFIG_FEATURE_COMMAND_TAB_COMPLETION
1303 case '\t': /* Alt-Tab */ 1303 case '\t': /* Alt-Tab */
1304 1304
1305 input_tab(&lastWasTab); 1305 input_tab(&lastWasTab);
@@ -1367,7 +1367,7 @@ prepare_to_die:
1367 } 1367 }
1368 1368
1369 default: /* If it's regular input, do the normal thing */ 1369 default: /* If it's regular input, do the normal thing */
1370#ifdef BB_FEATURE_NONPRINTABLE_INVERSE_PUT 1370#ifdef CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT
1371 /* Control-V -- Add non-printable symbol */ 1371 /* Control-V -- Add non-printable symbol */
1372 if (c == 22) { 1372 if (c == 22) {
1373 if (safe_read(0, &c, 1) < 1) 1373 if (safe_read(0, &c, 1) < 1)
@@ -1457,7 +1457,7 @@ prepare_to_die:
1457 history_counter++; 1457 history_counter++;
1458 } 1458 }
1459 } 1459 }
1460#if defined(BB_FEATURE_SH_FANCY_PROMPT) 1460#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT)
1461 num_ok_lines++; 1461 num_ok_lines++;
1462#endif 1462#endif
1463 } 1463 }
@@ -1465,10 +1465,10 @@ prepare_to_die:
1465 command[len++] = '\n'; /* set '\n' */ 1465 command[len++] = '\n'; /* set '\n' */
1466 command[len] = 0; 1466 command[len] = 0;
1467 } 1467 }
1468#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION) 1468#if defined(CONFIG_FEATURE_CLEAN_UP) && defined(CONFIG_FEATURE_COMMAND_TAB_COMPLETION)
1469 input_tab(0); /* strong free */ 1469 input_tab(0); /* strong free */
1470#endif 1470#endif
1471#if defined(BB_FEATURE_SH_FANCY_PROMPT) 1471#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT)
1472 free(cmdedit_prompt); 1472 free(cmdedit_prompt);
1473#endif 1473#endif
1474 cmdedit_reset_term(); 1474 cmdedit_reset_term();
@@ -1477,7 +1477,7 @@ prepare_to_die:
1477 1477
1478 1478
1479 1479
1480#endif /* BB_FEATURE_COMMAND_EDITING */ 1480#endif /* CONFIG_FEATURE_COMMAND_EDITING */
1481 1481
1482 1482
1483#ifdef TEST 1483#ifdef TEST
@@ -1485,7 +1485,7 @@ prepare_to_die:
1485const char *applet_name = "debug stuff usage"; 1485const char *applet_name = "debug stuff usage";
1486const char *memory_exhausted = "Memory exhausted"; 1486const char *memory_exhausted = "Memory exhausted";
1487 1487
1488#ifdef BB_FEATURE_NONPRINTABLE_INVERSE_PUT 1488#ifdef CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT
1489#include <locale.h> 1489#include <locale.h>
1490#endif 1490#endif
1491 1491
@@ -1493,7 +1493,7 @@ int main(int argc, char **argv)
1493{ 1493{
1494 char buff[BUFSIZ]; 1494 char buff[BUFSIZ];
1495 char *prompt = 1495 char *prompt =
1496#if defined(BB_FEATURE_SH_FANCY_PROMPT) 1496#if defined(CONFIG_FEATURE_SH_FANCY_PROMPT)
1497 "\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:\ 1497 "\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:\
1498\\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] \ 1498\\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] \
1499\\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]"; 1499\\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]";
@@ -1501,7 +1501,7 @@ int main(int argc, char **argv)
1501 "% "; 1501 "% ";
1502#endif 1502#endif
1503 1503
1504#ifdef BB_FEATURE_NONPRINTABLE_INVERSE_PUT 1504#ifdef CONFIG_FEATURE_NONPRINTABLE_INVERSE_PUT
1505 setlocale(LC_ALL, ""); 1505 setlocale(LC_ALL, "");
1506#endif 1506#endif
1507 while(1) { 1507 while(1) {
diff --git a/shell/config.in b/shell/config.in
new file mode 100644
index 000000000..e33669a7b
--- /dev/null
+++ b/shell/config.in
@@ -0,0 +1,51 @@
1#
2# For a description of the syntax of this configuration file,
3# see scripts/kbuild/config-language.txt.
4#
5
6mainmenu_option next_comment
7comment 'Bourne Shell'
8
9choice 'Choose your default shell' \
10 "ash CONFIG_FEATURE_SH_IS_ASH \
11 hush CONFIG_FEATURE_SH_IS_HUSH \
12 lash CONFIG_FEATURE_SH_IS_LASH \
13 msh CONFIG_FEATURE_SH_IS_MSH \
14 none CONFIG_FEATURE_SH_IS_NONE"
15
16if [ "$CONFIG_FEATURE_SH_IS_ASH" = "y" ] ; then
17 define_bool CONFIG_ASH y
18else
19 bool 'ash' CONFIG_ASH
20fi
21
22if [ "$CONFIG_FEATURE_SH_IS_HUSH" = "y" ] ; then
23 define_bool CONFIG_HUSH y
24else
25 bool 'hush' CONFIG_HUSH
26fi
27
28if [ "$CONFIG_FEATURE_SH_IS_LASH" = "y" ] ; then
29 define_bool CONFIG_LASH y
30else
31 bool 'lash' CONFIG_LASH
32fi
33
34if [ "$CONFIG_FEATURE_SH_IS_MSH" = "y" ] ; then
35 define_bool CONFIG_MSH y
36else
37 bool 'msh' CONFIG_MSH
38fi
39
40
41comment 'Bourne Shell Options'
42bool 'command line editing' CONFIG_FEATURE_COMMAND_EDITING
43bool 'tab completion' CONFIG_FEATURE_COMMAND_TAB_COMPLETION
44bool 'username completion' CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION
45bool 'Standalone shell' CONFIG_FEATURE_SH_STANDALONE_SHELL
46bool 'Standalone shell -- applets always win' CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
47bool 'Fancy shell prompts' CONFIG_FEATURE_SH_FANCY_PROMPT
48bool 'Hide message on interactive shell startup' CONFIG_FEATURE_SH_EXTRA_QUIET
49
50endmenu
51
diff --git a/shell/hush.c b/shell/hush.c
index cb0e6e980..d37842b79 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -113,7 +113,8 @@
113#define applet_name "hush" 113#define applet_name "hush"
114#include "standalone.h" 114#include "standalone.h"
115#define hush_main main 115#define hush_main main
116#undef BB_FEATURE_SH_FANCY_PROMPT 116#undef CONFIG_FEATURE_SH_FANCY_PROMPT
117#define BB_BANNER
117#endif 118#endif
118 119
119typedef enum { 120typedef enum {
@@ -836,7 +837,7 @@ static int static_peek(struct in_str *i)
836 837
837static inline void cmdedit_set_initial_prompt(void) 838static inline void cmdedit_set_initial_prompt(void)
838{ 839{
839#ifndef BB_FEATURE_SH_FANCY_PROMPT 840#ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
840 PS1 = NULL; 841 PS1 = NULL;
841#else 842#else
842 PS1 = getenv("PS1"); 843 PS1 = getenv("PS1");
@@ -848,7 +849,7 @@ static inline void cmdedit_set_initial_prompt(void)
848static inline void setup_prompt_string(int promptmode, char **prompt_str) 849static inline void setup_prompt_string(int promptmode, char **prompt_str)
849{ 850{
850 debug_printf("setup_prompt_string %d ",promptmode); 851 debug_printf("setup_prompt_string %d ",promptmode);
851#ifndef BB_FEATURE_SH_FANCY_PROMPT 852#ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
852 /* Set up the prompt */ 853 /* Set up the prompt */
853 if (promptmode == 1) { 854 if (promptmode == 1) {
854 if (PS1) 855 if (PS1)
@@ -871,7 +872,7 @@ static void get_user_input(struct in_str *i)
871 static char the_command[BUFSIZ]; 872 static char the_command[BUFSIZ];
872 873
873 setup_prompt_string(i->promptmode, &prompt_str); 874 setup_prompt_string(i->promptmode, &prompt_str);
874#ifdef BB_FEATURE_COMMAND_EDITING 875#ifdef CONFIG_FEATURE_COMMAND_EDITING
875 /* 876 /*
876 ** enable command line editing only while a command line 877 ** enable command line editing only while a command line
877 ** is actually being read; otherwise, we'll end up bequeathing 878 ** is actually being read; otherwise, we'll end up bequeathing
@@ -1085,18 +1086,18 @@ static void pseudo_exec(struct child_prog *child)
1085 * really dislike relying on /proc for things. We could exec ourself 1086 * really dislike relying on /proc for things. We could exec ourself
1086 * from global_argv[0], but if we are in a chroot, we may not be able 1087 * from global_argv[0], but if we are in a chroot, we may not be able
1087 * to find ourself... */ 1088 * to find ourself... */
1088#ifdef BB_FEATURE_SH_STANDALONE_SHELL 1089#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
1089 { 1090 {
1090 int argc_l; 1091 int argc_l;
1091 char** argv_l=child->argv; 1092 char** argv_l=child->argv;
1092 char *name = child->argv[0]; 1093 char *name = child->argv[0];
1093 1094
1094#ifdef BB_FEATURE_SH_APPLETS_ALWAYS_WIN 1095#ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
1095 /* Following discussions from November 2000 on the busybox mailing 1096 /* Following discussions from November 2000 on the busybox mailing
1096 * list, the default configuration, (without 1097 * list, the default configuration, (without
1097 * get_last_path_component()) lets the user force use of an 1098 * get_last_path_component()) lets the user force use of an
1098 * external command by specifying the full (with slashes) filename. 1099 * external command by specifying the full (with slashes) filename.
1099 * If you enable BB_FEATURE_SH_APPLETS_ALWAYS_WIN, then applets 1100 * If you enable CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN, then applets
1100 * _aways_ override external commands, so if you want to run 1101 * _aways_ override external commands, so if you want to run
1101 * /bin/cat, it will use BusyBox cat even if /bin/cat exists on the 1102 * /bin/cat, it will use BusyBox cat even if /bin/cat exists on the
1102 * filesystem and is _not_ busybox. Some systems may want this, 1103 * filesystem and is _not_ busybox. Some systems may want this,
@@ -2586,7 +2587,7 @@ int hush_main(int argc, char **argv)
2586 2587
2587 /* Initialize some more globals to non-zero values */ 2588 /* Initialize some more globals to non-zero values */
2588 set_cwd(); 2589 set_cwd();
2589#ifdef BB_FEATURE_COMMAND_EDITING 2590#ifdef CONFIG_FEATURE_COMMAND_EDITING
2590 cmdedit_set_initial_prompt(); 2591 cmdedit_set_initial_prompt();
2591#else 2592#else
2592 PS1 = NULL; 2593 PS1 = NULL;
@@ -2655,7 +2656,7 @@ int hush_main(int argc, char **argv)
2655 debug_printf("\ninteractive=%d\n", interactive); 2656 debug_printf("\ninteractive=%d\n", interactive);
2656 if (interactive) { 2657 if (interactive) {
2657 /* Looks like they want an interactive shell */ 2658 /* Looks like they want an interactive shell */
2658#ifndef BB_FEATURE_SH_EXTRA_QUIET 2659#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET
2659 printf( "\n\n" BB_BANNER " hush - the humble shell v0.01 (testing)\n"); 2660 printf( "\n\n" BB_BANNER " hush - the humble shell v0.01 (testing)\n");
2660 printf( "Enter 'help' for a list of built-in commands.\n\n"); 2661 printf( "Enter 'help' for a list of built-in commands.\n\n");
2661#endif 2662#endif
@@ -2673,7 +2674,7 @@ int hush_main(int argc, char **argv)
2673 input = xfopen(argv[optind], "r"); 2674 input = xfopen(argv[optind], "r");
2674 opt = parse_file_outer(input); 2675 opt = parse_file_outer(input);
2675 2676
2676#ifdef BB_FEATURE_CLEAN_UP 2677#ifdef CONFIG_FEATURE_CLEAN_UP
2677 fclose(input); 2678 fclose(input);
2678 if (cwd && cwd != unknown) 2679 if (cwd && cwd != unknown)
2679 free((char*)cwd); 2680 free((char*)cwd);
diff --git a/shell/lash.c b/shell/lash.c
index ffdec8781..004d9495a 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -2,8 +2,8 @@
2/* 2/*
3 * lash -- the BusyBox Lame-Ass SHell 3 * lash -- the BusyBox Lame-Ass SHell
4 * 4 *
5 * Copyright (C) 1999,2000,2001 by Lineo, inc. 5 * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
6 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 * Copyright (C) 1999,2000,2001 by Erik Andersen <andersee@debian.org>
7 * 7 *
8 * Based in part on ladsh.c by Michael K. Johnson and Erik W. Troan, which is 8 * Based in part on ladsh.c by Michael K. Johnson and Erik W. Troan, which is
9 * under the following liberal license: "We have placed this source code in the 9 * under the following liberal license: "We have placed this source code in the
@@ -25,8 +25,10 @@
25 * 25 *
26 */ 26 */
27 27
28/* This shell's parsing engine is officially at a dead-end. 28/* This shell's parsing engine is officially at a dead-end. Future
29 * Future work shell work should be done using hush.c 29 * work shell work should be done using hush, msh, or ash. This is
30 * still a very useful, small shell -- it just don't need any more
31 * features beyond what it already has...
30 */ 32 */
31 33
32//For debugging/development on the shell only... 34//For debugging/development on the shell only...
@@ -48,7 +50,7 @@
48#include "busybox.h" 50#include "busybox.h"
49#include "cmdedit.h" 51#include "cmdedit.h"
50 52
51#ifdef BB_LOCALE_SUPPORT 53#ifdef CONFIG_LOCALE_SUPPORT
52#include <locale.h> 54#include <locale.h>
53#endif 55#endif
54 56
@@ -390,12 +392,12 @@ static int builtin_export(struct child_prog *child)
390 res = putenv(v); 392 res = putenv(v);
391 if (res) 393 if (res)
392 fprintf(stderr, "export: %m\n"); 394 fprintf(stderr, "export: %m\n");
393#ifdef BB_FEATURE_SH_FANCY_PROMPT 395#ifdef CONFIG_FEATURE_SH_FANCY_PROMPT
394 if (strncmp(v, "PS1=", 4)==0) 396 if (strncmp(v, "PS1=", 4)==0)
395 PS1 = getenv("PS1"); 397 PS1 = getenv("PS1");
396#endif 398#endif
397 399
398#ifdef BB_LOCALE_SUPPORT 400#ifdef CONFIG_LOCALE_SUPPORT
399 if(strncmp(v, "LC_ALL=", 7)==0) 401 if(strncmp(v, "LC_ALL=", 7)==0)
400 setlocale(LC_ALL, getenv("LC_ALL")); 402 setlocale(LC_ALL, getenv("LC_ALL"));
401 if(strncmp(v, "LC_CTYPE=", 9)==0) 403 if(strncmp(v, "LC_CTYPE=", 9)==0)
@@ -661,7 +663,7 @@ static void restore_redirects(int squirrel[])
661 663
662static inline void cmdedit_set_initial_prompt(void) 664static inline void cmdedit_set_initial_prompt(void)
663{ 665{
664#ifndef BB_FEATURE_SH_FANCY_PROMPT 666#ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
665 PS1 = NULL; 667 PS1 = NULL;
666#else 668#else
667 PS1 = getenv("PS1"); 669 PS1 = getenv("PS1");
@@ -672,7 +674,7 @@ static inline void cmdedit_set_initial_prompt(void)
672 674
673static inline void setup_prompt_string(char **prompt_str) 675static inline void setup_prompt_string(char **prompt_str)
674{ 676{
675#ifndef BB_FEATURE_SH_FANCY_PROMPT 677#ifndef CONFIG_FEATURE_SH_FANCY_PROMPT
676 /* Set up the prompt */ 678 /* Set up the prompt */
677 if (shell_context == 0) { 679 if (shell_context == 0) {
678 if (PS1) 680 if (PS1)
@@ -706,7 +708,7 @@ static int get_command(FILE * source, char *command)
706 if (source == stdin) { 708 if (source == stdin) {
707 setup_prompt_string(&prompt_str); 709 setup_prompt_string(&prompt_str);
708 710
709#ifdef BB_FEATURE_COMMAND_EDITING 711#ifdef CONFIG_FEATURE_COMMAND_EDITING
710 /* 712 /*
711 ** enable command line editing only while a command line 713 ** enable command line editing only while a command line
712 ** is actually being read; otherwise, we'll end up bequeathing 714 ** is actually being read; otherwise, we'll end up bequeathing
@@ -1201,7 +1203,7 @@ static int parse_command(char **command_ptr, struct job *job, int *inbg)
1201static int pseudo_exec(struct child_prog *child) 1203static int pseudo_exec(struct child_prog *child)
1202{ 1204{
1203 struct built_in_command *x; 1205 struct built_in_command *x;
1204#ifdef BB_FEATURE_SH_STANDALONE_SHELL 1206#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
1205 char *name; 1207 char *name;
1206#endif 1208#endif
1207 1209
@@ -1223,7 +1225,7 @@ static int pseudo_exec(struct child_prog *child)
1223 exit (x->function(child)); 1225 exit (x->function(child));
1224 } 1226 }
1225 } 1227 }
1226#ifdef BB_FEATURE_SH_STANDALONE_SHELL 1228#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
1227 /* Check if the command matches any busybox internal 1229 /* Check if the command matches any busybox internal
1228 * commands ("applets") here. Following discussions from 1230 * commands ("applets") here. Following discussions from
1229 * November 2000 on busybox@opensource.lineo.com, don't use 1231 * November 2000 on busybox@opensource.lineo.com, don't use
@@ -1237,8 +1239,8 @@ static int pseudo_exec(struct child_prog *child)
1237 */ 1239 */
1238 name = child->argv[0]; 1240 name = child->argv[0];
1239 1241
1240#ifdef BB_FEATURE_SH_APPLETS_ALWAYS_WIN 1242#ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
1241 /* If you enable BB_FEATURE_SH_APPLETS_ALWAYS_WIN, then 1243 /* If you enable CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN, then
1242 * if you run /bin/cat, it will use BusyBox cat even if 1244 * if you run /bin/cat, it will use BusyBox cat even if
1243 * /bin/cat exists on the filesystem and is _not_ busybox. 1245 * /bin/cat exists on the filesystem and is _not_ busybox.
1244 * Some systems want this, others do not. Choose wisely. :-) 1246 * Some systems want this, others do not. Choose wisely. :-)
@@ -1504,7 +1506,7 @@ static int busy_loop(FILE * input)
1504} 1506}
1505 1507
1506 1508
1507#ifdef BB_FEATURE_CLEAN_UP 1509#ifdef CONFIG_FEATURE_CLEAN_UP
1508void free_memory(void) 1510void free_memory(void)
1509{ 1511{
1510 if (cwd && cwd!=unknown) { 1512 if (cwd && cwd!=unknown) {
@@ -1611,7 +1613,7 @@ int lash_main(int argc_l, char **argv_l)
1611 if (interactive==TRUE) { 1613 if (interactive==TRUE) {
1612 //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]); 1614 //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]);
1613 /* Looks like they want an interactive shell */ 1615 /* Looks like they want an interactive shell */
1614#ifndef BB_FEATURE_SH_EXTRA_QUIET 1616#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET
1615 printf( "\n\n" BB_BANNER " Built-in shell (lash)\n"); 1617 printf( "\n\n" BB_BANNER " Built-in shell (lash)\n");
1616 printf( "Enter 'help' for a list of built-in commands.\n\n"); 1618 printf( "Enter 'help' for a list of built-in commands.\n\n");
1617#endif 1619#endif
@@ -1626,11 +1628,11 @@ int lash_main(int argc_l, char **argv_l)
1626 if (!cwd) 1628 if (!cwd)
1627 cwd = unknown; 1629 cwd = unknown;
1628 1630
1629#ifdef BB_FEATURE_CLEAN_UP 1631#ifdef CONFIG_FEATURE_CLEAN_UP
1630 atexit(free_memory); 1632 atexit(free_memory);
1631#endif 1633#endif
1632 1634
1633#ifdef BB_FEATURE_COMMAND_EDITING 1635#ifdef CONFIG_FEATURE_COMMAND_EDITING
1634 cmdedit_set_initial_prompt(); 1636 cmdedit_set_initial_prompt();
1635#else 1637#else
1636 PS1 = NULL; 1638 PS1 = NULL;
diff --git a/shell/msh.c b/shell/msh.c
index 5c4ec1019..a2f98c837 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -681,7 +681,7 @@ static void * brktop;
681static void * brkaddr; 681static void * brkaddr;
682 682
683 683
684#ifdef BB_FEATURE_COMMAND_EDITING 684#ifdef CONFIG_FEATURE_COMMAND_EDITING
685static char * current_prompt; 685static char * current_prompt;
686#endif 686#endif
687 687
@@ -732,7 +732,7 @@ extern int msh_main(int argc, char **argv)
732 setval(ifs, " \t\n"); 732 setval(ifs, " \t\n");
733 733
734 prompt = lookup("PS1"); 734 prompt = lookup("PS1");
735#ifdef BB_FEATURE_SH_FANCY_PROMPT 735#ifdef CONFIG_FEATURE_SH_FANCY_PROMPT
736 if (prompt->value == null) 736 if (prompt->value == null)
737#endif 737#endif
738 setval(prompt, "$ "); 738 setval(prompt, "$ ");
@@ -741,7 +741,7 @@ extern int msh_main(int argc, char **argv)
741 prompt->status &= ~EXPORT; 741 prompt->status &= ~EXPORT;
742 } 742 }
743 cprompt = lookup("PS2"); 743 cprompt = lookup("PS2");
744#ifdef BB_FEATURE_SH_FANCY_PROMPT 744#ifdef CONFIG_FEATURE_SH_FANCY_PROMPT
745 if (cprompt->value == null) 745 if (cprompt->value == null)
746#endif 746#endif
747 setval(cprompt, "> "); 747 setval(cprompt, "> ");
@@ -801,7 +801,7 @@ extern int msh_main(int argc, char **argv)
801 PUSHIO(afile, 0, iof); 801 PUSHIO(afile, 0, iof);
802 if (isatty(0) && isatty(1) && !cflag) { 802 if (isatty(0) && isatty(1) && !cflag) {
803 interactive++; 803 interactive++;
804#ifndef BB_FEATURE_SH_EXTRA_QUIET 804#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET
805 printf( "\n\n" BB_BANNER " Built-in shell (msh)\n"); 805 printf( "\n\n" BB_BANNER " Built-in shell (msh)\n");
806 printf( "Enter 'help' for a list of built-in commands.\n\n"); 806 printf( "Enter 'help' for a list of built-in commands.\n\n");
807#endif 807#endif
@@ -835,7 +835,7 @@ extern int msh_main(int argc, char **argv)
835 835
836 for (;;) { 836 for (;;) {
837 if (interactive && e.iop <= iostack) { 837 if (interactive && e.iop <= iostack) {
838#ifdef BB_FEATURE_COMMAND_EDITING 838#ifdef CONFIG_FEATURE_COMMAND_EDITING
839 current_prompt=prompt->value; 839 current_prompt=prompt->value;
840#else 840#else
841 prs(prompt->value); 841 prs(prompt->value);
@@ -2171,7 +2171,7 @@ loop:
2171 startl = 1; 2171 startl = 1;
2172 if (multiline || cf & CONTIN) { 2172 if (multiline || cf & CONTIN) {
2173 if (interactive && e.iop <= iostack) { 2173 if (interactive && e.iop <= iostack) {
2174#ifdef BB_FEATURE_COMMAND_EDITING 2174#ifdef CONFIG_FEATURE_COMMAND_EDITING
2175 current_prompt=cprompt->value; 2175 current_prompt=cprompt->value;
2176#else 2176#else
2177 prs(cprompt->value); 2177 prs(cprompt->value);
@@ -2224,7 +2224,7 @@ register int c, c1;
2224 return(YYERRCODE); 2224 return(YYERRCODE);
2225 } 2225 }
2226 if (interactive && c == '\n' && e.iop <= iostack) { 2226 if (interactive && c == '\n' && e.iop <= iostack) {
2227#ifdef BB_FEATURE_COMMAND_EDITING 2227#ifdef CONFIG_FEATURE_COMMAND_EDITING
2228 current_prompt=cprompt->value; 2228 current_prompt=cprompt->value;
2229#else 2229#else
2230 prs(cprompt->value); 2230 prs(cprompt->value);
@@ -2838,9 +2838,9 @@ char *c, **v, **envp;
2838 register char *sp, *tp; 2838 register char *sp, *tp;
2839 int eacces = 0, asis = 0; 2839 int eacces = 0, asis = 0;
2840 2840
2841#ifdef BB_FEATURE_SH_STANDALONE_SHELL 2841#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
2842 char *name = c; 2842 char *name = c;
2843#ifdef BB_FEATURE_SH_APPLETS_ALWAYS_WIN 2843#ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
2844 name = get_last_path_component(name); 2844 name = get_last_path_component(name);
2845#endif 2845#endif
2846 optind = 1; 2846 optind = 1;
@@ -2960,7 +2960,7 @@ static int dohelp()
2960 col = 0; 2960 col = 0;
2961 } 2961 }
2962 } 2962 }
2963#ifdef BB_FEATURE_SH_STANDALONE_SHELL 2963#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
2964 { 2964 {
2965 int i; 2965 int i;
2966 const struct BB_applet *applet; 2966 const struct BB_applet *applet;
@@ -4256,7 +4256,7 @@ readc()
4256 if (multiline) 4256 if (multiline)
4257 return e.iop->prev = 0; 4257 return e.iop->prev = 0;
4258 if (interactive && e.iop == iostack+1) { 4258 if (interactive && e.iop == iostack+1) {
4259#ifdef BB_FEATURE_COMMAND_EDITING 4259#ifdef CONFIG_FEATURE_COMMAND_EDITING
4260 current_prompt=prompt->value; 4260 current_prompt=prompt->value;
4261#else 4261#else
4262 prs(prompt->value); 4262 prs(prompt->value);
@@ -4462,7 +4462,7 @@ register struct ioarg *ap;
4462 return *bp->bufp++ & 0177; 4462 return *bp->bufp++ & 0177;
4463 } 4463 }
4464 4464
4465#ifdef BB_FEATURE_COMMAND_EDITING 4465#ifdef CONFIG_FEATURE_COMMAND_EDITING
4466 if (interactive) { 4466 if (interactive) {
4467 static char mycommand[BUFSIZ]; 4467 static char mycommand[BUFSIZ];
4468 static int position = 0, size = 0; 4468 static int position = 0, size = 0;
@@ -4721,7 +4721,7 @@ int ec;
4721 e.iobase = e.iop; 4721 e.iobase = e.iop;
4722 for (;;) { 4722 for (;;) {
4723 if (interactive && e.iop <= iostack) { 4723 if (interactive && e.iop <= iostack) {
4724#ifdef BB_FEATURE_COMMAND_EDITING 4724#ifdef CONFIG_FEATURE_COMMAND_EDITING
4725 current_prompt=cprompt->value; 4725 current_prompt=cprompt->value;
4726#else 4726#else
4727 prs(cprompt->value); 4727 prs(cprompt->value);