diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-22 09:03:07 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-22 09:03:07 +0000 |
commit | 38f6319421c1892ea5c9c0484cec0e190bdc5c69 (patch) | |
tree | 99a63bee4f133df98eb870308c4ca75e8dcbd8c1 | |
parent | 253ce0029669919fbb7cf60b5c9eab2f791939d8 (diff) | |
download | busybox-w32-38f6319421c1892ea5c9c0484cec0e190bdc5c69.tar.gz busybox-w32-38f6319421c1892ea5c9c0484cec0e190bdc5c69.tar.bz2 busybox-w32-38f6319421c1892ea5c9c0484cec0e190bdc5c69.zip |
cmdedit is not a 'command' editing anymore, it's just editing (generic),
so rename stuff accordingly.
-rw-r--r-- | include/libbb.h | 16 | ||||
-rw-r--r-- | libbb/Config.in | 59 | ||||
-rw-r--r-- | libbb/Kbuild | 1 | ||||
-rw-r--r-- | scripts/defconfig | 14 | ||||
-rw-r--r-- | shell/Config.in | 60 | ||||
-rw-r--r-- | shell/Kbuild | 1 | ||||
-rw-r--r-- | shell/ash.c | 18 | ||||
-rw-r--r-- | shell/cmdedit.c | 58 | ||||
-rw-r--r-- | shell/hush.c | 19 | ||||
-rw-r--r-- | shell/lash.c | 14 | ||||
-rw-r--r-- | shell/msh.c | 28 |
11 files changed, 144 insertions, 144 deletions
diff --git a/include/libbb.h b/include/libbb.h index f990b0ebd..ede44526b 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -583,10 +583,10 @@ extern unsigned long long bb_makedev(unsigned int major, unsigned int minor); | |||
583 | #endif | 583 | #endif |
584 | 584 | ||
585 | 585 | ||
586 | #if ENABLE_FEATURE_COMMAND_EDITING | 586 | #if ENABLE_FEATURE_EDITING |
587 | /* It's NOT just ENABLEd or disabled. It's a number: */ | 587 | /* It's NOT just ENABLEd or disabled. It's a number: */ |
588 | #ifdef CONFIG_FEATURE_COMMAND_HISTORY | 588 | #ifdef CONFIG_FEATURE_EDITING_HISTORY |
589 | #define MAX_HISTORY (CONFIG_FEATURE_COMMAND_HISTORY + 0) | 589 | #define MAX_HISTORY (CONFIG_FEATURE_EDITING_HISTORY + 0) |
590 | #else | 590 | #else |
591 | #define MAX_HISTORY 0 | 591 | #define MAX_HISTORY 0 |
592 | #endif | 592 | #endif |
@@ -596,16 +596,16 @@ struct line_input_t { | |||
596 | #if MAX_HISTORY | 596 | #if MAX_HISTORY |
597 | int cnt_history; | 597 | int cnt_history; |
598 | int cur_history; | 598 | int cur_history; |
599 | USE_FEATURE_COMMAND_SAVEHISTORY(const char *hist_file;) | 599 | USE_FEATURE_EDITING_SAVEHISTORY(const char *hist_file;) |
600 | char *history[MAX_HISTORY + 1]; | 600 | char *history[MAX_HISTORY + 1]; |
601 | #endif | 601 | #endif |
602 | }; | 602 | }; |
603 | enum { | 603 | enum { |
604 | DO_HISTORY = 1 * (MAX_HISTORY > 0), | 604 | DO_HISTORY = 1 * (MAX_HISTORY > 0), |
605 | SAVE_HISTORY = 2 * (MAX_HISTORY > 0) * ENABLE_FEATURE_COMMAND_SAVEHISTORY, | 605 | SAVE_HISTORY = 2 * (MAX_HISTORY > 0) * ENABLE_FEATURE_EDITING_SAVEHISTORY, |
606 | TAB_COMPLETION = 4 * ENABLE_FEATURE_COMMAND_TAB_COMPLETION, | 606 | TAB_COMPLETION = 4 * ENABLE_FEATURE_TAB_COMPLETION, |
607 | USERNAME_COMPLETION = 8 * ENABLE_FEATURE_COMMAND_USERNAME_COMPLETION, | 607 | USERNAME_COMPLETION = 8 * ENABLE_FEATURE_USERNAME_COMPLETION, |
608 | VI_MODE = 0x10 * ENABLE_FEATURE_COMMAND_EDITING_VI, | 608 | VI_MODE = 0x10 * ENABLE_FEATURE_EDITING_VI, |
609 | WITH_PATH_LOOKUP = 0x20, | 609 | WITH_PATH_LOOKUP = 0x20, |
610 | FOR_SHELL = DO_HISTORY | SAVE_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION, | 610 | FOR_SHELL = DO_HISTORY | SAVE_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION, |
611 | }; | 611 | }; |
diff --git a/libbb/Config.in b/libbb/Config.in index 92ee55cbc..112a3d658 100644 --- a/libbb/Config.in +++ b/libbb/Config.in | |||
@@ -26,4 +26,63 @@ config MD5_SIZE_VS_SPEED | |||
26 | 2 3.0 5088 | 26 | 2 3.0 5088 |
27 | 3 (smallest) 5.1 4912 | 27 | 3 (smallest) 5.1 4912 |
28 | 28 | ||
29 | config FEATURE_EDITING | ||
30 | bool "Command line editing" | ||
31 | default n | ||
32 | help | ||
33 | Enable command editing (mainly for shell). | ||
34 | |||
35 | config FEATURE_EDITING_FANCY_KEYS | ||
36 | bool "Additional editing keys" | ||
37 | default n | ||
38 | depends on FEATURE_EDITING | ||
39 | help | ||
40 | Enable additonal editing keys (Ctrl-E, Ctrl-U etc). | ||
41 | Arrow keys, Home/End/Delete and Ctrl-W work even without this option. | ||
42 | |||
43 | config FEATURE_EDITING_VI | ||
44 | bool "vi-style line editing commands" | ||
45 | default n | ||
46 | depends on FEATURE_EDITING | ||
47 | help | ||
48 | Enable vi-style line editing. In shells, this mode can be | ||
49 | turned on and off with "set -o vi" and "set +o vi". | ||
50 | |||
51 | config FEATURE_EDITING_HISTORY | ||
52 | int "History size" | ||
53 | range 0 99999 | ||
54 | default 15 | ||
55 | depends on FEATURE_EDITING | ||
56 | help | ||
57 | Specify command history size. | ||
58 | |||
59 | config FEATURE_EDITING_SAVEHISTORY | ||
60 | bool "History saving" | ||
61 | default n | ||
62 | depends on ASH && FEATURE_EDITING | ||
63 | help | ||
64 | Enable history saving in ash shell. | ||
65 | |||
66 | config FEATURE_TAB_COMPLETION | ||
67 | bool "Tab completion" | ||
68 | default n | ||
69 | depends on FEATURE_EDITING | ||
70 | help | ||
71 | Enable tab completion. | ||
72 | |||
73 | config FEATURE_USERNAME_COMPLETION | ||
74 | bool "Username completion" | ||
75 | default n | ||
76 | depends on FEATURE_TAB_COMPLETION | ||
77 | help | ||
78 | Enable username completion. | ||
79 | |||
80 | config FEATURE_EDITING_FANCY_PROMPT | ||
81 | bool "Fancy shell prompts" | ||
82 | default n | ||
83 | depends on FEATURE_EDITING | ||
84 | help | ||
85 | Setting this option allows for prompts to use things like \w and | ||
86 | \$ and escape codes. | ||
87 | |||
29 | endmenu | 88 | endmenu |
diff --git a/libbb/Kbuild b/libbb/Kbuild index a6d695340..1e6b5fea7 100644 --- a/libbb/Kbuild +++ b/libbb/Kbuild | |||
@@ -46,6 +46,7 @@ lib-y += inode_hash.o | |||
46 | lib-y += isdirectory.o | 46 | lib-y += isdirectory.o |
47 | lib-y += kernel_version.o | 47 | lib-y += kernel_version.o |
48 | lib-y += last_char_is.o | 48 | lib-y += last_char_is.o |
49 | lib-y += lineedit.o | ||
49 | lib-y += llist.o | 50 | lib-y += llist.o |
50 | lib-y += login.o | 51 | lib-y += login.o |
51 | lib-y += make_directory.o | 52 | lib-y += make_directory.o |
diff --git a/scripts/defconfig b/scripts/defconfig index 503f12a01..2c82a5358 100644 --- a/scripts/defconfig +++ b/scripts/defconfig | |||
@@ -631,14 +631,14 @@ CONFIG_FEATURE_SH_IS_NONE=y | |||
631 | # CONFIG_MSH is not set | 631 | # CONFIG_MSH is not set |
632 | # CONFIG_FEATURE_SH_EXTRA_QUIET is not set | 632 | # CONFIG_FEATURE_SH_EXTRA_QUIET is not set |
633 | # CONFIG_FEATURE_SH_STANDALONE_SHELL is not set | 633 | # CONFIG_FEATURE_SH_STANDALONE_SHELL is not set |
634 | # CONFIG_FEATURE_COMMAND_EDITING is not set | 634 | CONFIG_FEATURE_EDITING=y |
635 | # CONFIG_FEATURE_EDITING_FANCY_KEYS is not set | 635 | # CONFIG_FEATURE_EDITING_FANCY_KEYS is not set |
636 | # CONFIG_FEATURE_COMMAND_EDITING_VI is not set | 636 | # CONFIG_FEATURE_EDITING_VI is not set |
637 | CONFIG_FEATURE_COMMAND_HISTORY= | 637 | CONFIG_FEATURE_EDITING_HISTORY=15 |
638 | # CONFIG_FEATURE_COMMAND_SAVEHISTORY is not set | 638 | # CONFIG_FEATURE_EDITING_SAVEHISTORY is not set |
639 | # CONFIG_FEATURE_COMMAND_TAB_COMPLETION is not set | 639 | # CONFIG_FEATURE_TAB_COMPLETION is not set |
640 | # CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION is not set | 640 | # CONFIG_FEATURE_USERNAME_COMPLETION is not set |
641 | # CONFIG_FEATURE_SH_FANCY_PROMPT is not set | 641 | # CONFIG_FEATURE_EDITING_FANCY_PROMPT is not set |
642 | 642 | ||
643 | # | 643 | # |
644 | # System Logging Utilities | 644 | # System Logging Utilities |
diff --git a/shell/Config.in b/shell/Config.in index 15c52be54..3cd7c3c5b 100644 --- a/shell/Config.in +++ b/shell/Config.in | |||
@@ -240,64 +240,4 @@ config FEATURE_SH_STANDALONE_SHELL | |||
240 | that exact location with that exact name, this option will not work at | 240 | that exact location with that exact name, this option will not work at |
241 | all. | 241 | all. |
242 | 242 | ||
243 | config FEATURE_COMMAND_EDITING | ||
244 | bool "Command line editing" | ||
245 | default n | ||
246 | depends on MSH || LASH || HUSH || ASH | ||
247 | help | ||
248 | Enable command editing in shell. | ||
249 | |||
250 | config FEATURE_EDITING_FANCY_KEYS | ||
251 | bool "Additional editing keys" | ||
252 | default n | ||
253 | depends on FEATURE_COMMAND_EDITING | ||
254 | help | ||
255 | Enable additonal editing keys (Ctrl-E, Ctrl-U etc). | ||
256 | Arrow keys, Home/End/Delete and Ctrl-W work even without this option. | ||
257 | |||
258 | config FEATURE_COMMAND_EDITING_VI | ||
259 | bool "vi-style line editing commands" | ||
260 | default n | ||
261 | depends on FEATURE_COMMAND_EDITING | ||
262 | help | ||
263 | Enable vi-style line editing in the shell. This mode can be | ||
264 | turned on and off with "set -o vi" and "set +o vi". | ||
265 | |||
266 | config FEATURE_COMMAND_HISTORY | ||
267 | int "History size" | ||
268 | range 0 99999 | ||
269 | default 15 | ||
270 | depends on FEATURE_COMMAND_EDITING | ||
271 | help | ||
272 | Specify command history size in shell. | ||
273 | |||
274 | config FEATURE_COMMAND_SAVEHISTORY | ||
275 | bool "History saving" | ||
276 | default n | ||
277 | depends on ASH && FEATURE_COMMAND_EDITING | ||
278 | help | ||
279 | Enable history saving in ash shell. | ||
280 | |||
281 | config FEATURE_COMMAND_TAB_COMPLETION | ||
282 | bool "Tab completion" | ||
283 | default n | ||
284 | depends on FEATURE_COMMAND_EDITING | ||
285 | help | ||
286 | Enable tab completion in shell. | ||
287 | |||
288 | config FEATURE_COMMAND_USERNAME_COMPLETION | ||
289 | bool "Username completion" | ||
290 | default n | ||
291 | depends on FEATURE_COMMAND_TAB_COMPLETION | ||
292 | help | ||
293 | Enable username completion in shell. | ||
294 | |||
295 | config FEATURE_SH_FANCY_PROMPT | ||
296 | bool "Fancy shell prompts" | ||
297 | default n | ||
298 | depends on FEATURE_COMMAND_EDITING | ||
299 | help | ||
300 | Setting this option allows for prompts to use things like \w and | ||
301 | \$ and also using escape codes. | ||
302 | |||
303 | endmenu | 243 | endmenu |
diff --git a/shell/Kbuild b/shell/Kbuild index 9c60698f7..6b58040fc 100644 --- a/shell/Kbuild +++ b/shell/Kbuild | |||
@@ -5,7 +5,6 @@ | |||
5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. | 5 | # Licensed under the GPL v2, see the file LICENSE in this tarball. |
6 | 6 | ||
7 | lib-y:= | 7 | lib-y:= |
8 | lib-y += cmdedit.o | ||
9 | lib-$(CONFIG_ASH) += ash.o | 8 | lib-$(CONFIG_ASH) += ash.o |
10 | lib-$(CONFIG_HUSH) += hush.o | 9 | lib-$(CONFIG_HUSH) += hush.o |
11 | lib-$(CONFIG_LASH) += lash.o | 10 | lib-$(CONFIG_LASH) += lash.o |
diff --git a/shell/ash.c b/shell/ash.c index 8afdf3d21..0f9b3288b 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -1528,7 +1528,7 @@ static struct var varinit[] = { | |||
1528 | {0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_ALL\0", change_lc_all }, | 1528 | {0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_ALL\0", change_lc_all }, |
1529 | {0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_CTYPE\0", change_lc_ctype }, | 1529 | {0, VSTRFIXED | VTEXTFIXED | VUNSET, "LC_CTYPE\0", change_lc_ctype }, |
1530 | #endif | 1530 | #endif |
1531 | #if ENABLE_FEATURE_COMMAND_SAVEHISTORY | 1531 | #if ENABLE_FEATURE_EDITING_SAVEHISTORY |
1532 | {0, VSTRFIXED | VTEXTFIXED | VUNSET, "HISTFILE\0", NULL }, | 1532 | {0, VSTRFIXED | VTEXTFIXED | VUNSET, "HISTFILE\0", NULL }, |
1533 | #endif | 1533 | #endif |
1534 | }; | 1534 | }; |
@@ -1654,7 +1654,7 @@ static void initvar(void) | |||
1654 | /* | 1654 | /* |
1655 | * PS1 depends on uid | 1655 | * PS1 depends on uid |
1656 | */ | 1656 | */ |
1657 | #if defined(CONFIG_FEATURE_COMMAND_EDITING) && defined(CONFIG_FEATURE_SH_FANCY_PROMPT) | 1657 | #if ENABLE_FEATURE_EDITING && ENABLE_FEATURE_EDITING_FANCY_PROMPT |
1658 | vps1.text = "PS1=\\w \\$ "; | 1658 | vps1.text = "PS1=\\w \\$ "; |
1659 | #else | 1659 | #else |
1660 | if (!geteuid()) | 1660 | if (!geteuid()) |
@@ -6040,7 +6040,7 @@ static char * pfgets(char *line, int len) | |||
6040 | } | 6040 | } |
6041 | 6041 | ||
6042 | 6042 | ||
6043 | #if ENABLE_FEATURE_COMMAND_EDITING | 6043 | #if ENABLE_FEATURE_EDITING |
6044 | static line_input_t *line_input_state; | 6044 | static line_input_t *line_input_state; |
6045 | //static SKIP_ASH_EXPAND_PRMT(const) char *cmdedit_prompt; | 6045 | //static SKIP_ASH_EXPAND_PRMT(const) char *cmdedit_prompt; |
6046 | static const char *cmdedit_prompt; | 6046 | static const char *cmdedit_prompt; |
@@ -6060,7 +6060,7 @@ static void putprompt(const char *s) | |||
6060 | } | 6060 | } |
6061 | #endif | 6061 | #endif |
6062 | 6062 | ||
6063 | #if ENABLE_FEATURE_COMMAND_EDITING_VI | 6063 | #if ENABLE_FEATURE_EDITING_VI |
6064 | #define setvimode(on) do { \ | 6064 | #define setvimode(on) do { \ |
6065 | if (on) line_input_state->flags |= VI_MODE; \ | 6065 | if (on) line_input_state->flags |= VI_MODE; \ |
6066 | else line_input_state->flags &= ~VI_MODE; \ | 6066 | else line_input_state->flags &= ~VI_MODE; \ |
@@ -6077,11 +6077,11 @@ static int preadfd(void) | |||
6077 | parsenextc = buf; | 6077 | parsenextc = buf; |
6078 | 6078 | ||
6079 | retry: | 6079 | retry: |
6080 | #if ENABLE_FEATURE_COMMAND_EDITING | 6080 | #if ENABLE_FEATURE_EDITING |
6081 | if (!iflag || parsefile->fd) | 6081 | if (!iflag || parsefile->fd) |
6082 | nr = safe_read(parsefile->fd, buf, BUFSIZ - 1); | 6082 | nr = safe_read(parsefile->fd, buf, BUFSIZ - 1); |
6083 | else { | 6083 | else { |
6084 | #if ENABLE_FEATURE_COMMAND_TAB_COMPLETION | 6084 | #if ENABLE_FEATURE_TAB_COMPLETION |
6085 | line_input_state->path_lookup = pathval(); | 6085 | line_input_state->path_lookup = pathval(); |
6086 | #endif | 6086 | #endif |
6087 | nr = read_line_input(cmdedit_prompt, buf, BUFSIZ, line_input_state); | 6087 | nr = read_line_input(cmdedit_prompt, buf, BUFSIZ, line_input_state); |
@@ -7916,7 +7916,7 @@ ash_main(int argc, char **argv) | |||
7916 | monitor(4, etext, profile_buf, sizeof profile_buf, 50); | 7916 | monitor(4, etext, profile_buf, sizeof profile_buf, 50); |
7917 | #endif | 7917 | #endif |
7918 | 7918 | ||
7919 | #if ENABLE_FEATURE_COMMAND_EDITING | 7919 | #if ENABLE_FEATURE_EDITING |
7920 | line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP); | 7920 | line_input_state = new_line_input_t(FOR_SHELL | WITH_PATH_LOOKUP); |
7921 | #endif | 7921 | #endif |
7922 | state = 0; | 7922 | state = 0; |
@@ -7960,7 +7960,7 @@ ash_main(int argc, char **argv) | |||
7960 | init(); | 7960 | init(); |
7961 | setstackmark(&smark); | 7961 | setstackmark(&smark); |
7962 | procargs(argc, argv); | 7962 | procargs(argc, argv); |
7963 | #if ENABLE_FEATURE_COMMAND_SAVEHISTORY | 7963 | #if ENABLE_FEATURE_EDITING_SAVEHISTORY |
7964 | if (iflag) { | 7964 | if (iflag) { |
7965 | const char *hp = lookupvar("HISTFILE"); | 7965 | const char *hp = lookupvar("HISTFILE"); |
7966 | 7966 | ||
@@ -8001,7 +8001,7 @@ state3: | |||
8001 | evalstring(minusc, 0); | 8001 | evalstring(minusc, 0); |
8002 | 8002 | ||
8003 | if (sflag || minusc == NULL) { | 8003 | if (sflag || minusc == NULL) { |
8004 | #if ENABLE_FEATURE_COMMAND_SAVEHISTORY | 8004 | #if ENABLE_FEATURE_EDITING_SAVEHISTORY |
8005 | if ( iflag ) { | 8005 | if ( iflag ) { |
8006 | const char *hp = lookupvar("HISTFILE"); | 8006 | const char *hp = lookupvar("HISTFILE"); |
8007 | 8007 | ||
diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 7588922a6..e62975db3 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c | |||
@@ -38,9 +38,9 @@ | |||
38 | 38 | ||
39 | #ifdef TEST | 39 | #ifdef TEST |
40 | 40 | ||
41 | #define ENABLE_FEATURE_COMMAND_EDITING 0 | 41 | #define ENABLE_FEATURE_EDITING 0 |
42 | #define ENABLE_FEATURE_COMMAND_TAB_COMPLETION 0 | 42 | #define ENABLE_FEATURE_TAB_COMPLETION 0 |
43 | #define ENABLE_FEATURE_COMMAND_USERNAME_COMPLETION 0 | 43 | #define ENABLE_FEATURE_USERNAME_COMPLETION 0 |
44 | #define ENABLE_FEATURE_NONPRINTABLE_INVERSE_PUT 0 | 44 | #define ENABLE_FEATURE_NONPRINTABLE_INVERSE_PUT 0 |
45 | #define ENABLE_FEATURE_CLEAN_UP 0 | 45 | #define ENABLE_FEATURE_CLEAN_UP 0 |
46 | 46 | ||
@@ -48,7 +48,7 @@ | |||
48 | 48 | ||
49 | 49 | ||
50 | /* Entire file (except TESTing part) sits inside this #if */ | 50 | /* Entire file (except TESTing part) sits inside this #if */ |
51 | #if ENABLE_FEATURE_COMMAND_EDITING | 51 | #if ENABLE_FEATURE_EDITING |
52 | 52 | ||
53 | #if ENABLE_LOCALE_SUPPORT | 53 | #if ENABLE_LOCALE_SUPPORT |
54 | #define Isprint(c) isprint(c) | 54 | #define Isprint(c) isprint(c) |
@@ -57,7 +57,7 @@ | |||
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | #define ENABLE_FEATURE_GETUSERNAME_AND_HOMEDIR \ | 59 | #define ENABLE_FEATURE_GETUSERNAME_AND_HOMEDIR \ |
60 | (ENABLE_FEATURE_COMMAND_USERNAME_COMPLETION || ENABLE_FEATURE_SH_FANCY_PROMPT) | 60 | (ENABLE_FEATURE_USERNAME_COMPLETION || ENABLE_FEATURE_EDITING_FANCY_PROMPT) |
61 | 61 | ||
62 | 62 | ||
63 | static line_input_t *state; | 63 | static line_input_t *state; |
@@ -75,7 +75,7 @@ static unsigned command_len; | |||
75 | static char *command_ps; | 75 | static char *command_ps; |
76 | static const char *cmdedit_prompt; | 76 | static const char *cmdedit_prompt; |
77 | 77 | ||
78 | #if ENABLE_FEATURE_SH_FANCY_PROMPT | 78 | #if ENABLE_FEATURE_EDITING_FANCY_PROMPT |
79 | static char *hostname_buf; | 79 | static char *hostname_buf; |
80 | static int num_ok_lines = 1; | 80 | static int num_ok_lines = 1; |
81 | #endif | 81 | #endif |
@@ -85,7 +85,7 @@ static char *user_buf = ""; | |||
85 | static char *home_pwd_buf = ""; | 85 | static char *home_pwd_buf = ""; |
86 | #endif | 86 | #endif |
87 | 87 | ||
88 | #if ENABLE_FEATURE_COMMAND_TAB_COMPLETION | 88 | #if ENABLE_FEATURE_TAB_COMPLETION |
89 | static int my_uid; | 89 | static int my_uid; |
90 | static int my_gid; | 90 | static int my_gid; |
91 | #endif | 91 | #endif |
@@ -208,7 +208,7 @@ static void redraw(int y, int back_cursor) | |||
208 | input_backward(back_cursor); | 208 | input_backward(back_cursor); |
209 | } | 209 | } |
210 | 210 | ||
211 | #if ENABLE_FEATURE_COMMAND_EDITING_VI | 211 | #if ENABLE_FEATURE_EDITING_VI |
212 | #define DELBUFSIZ 128 | 212 | #define DELBUFSIZ 128 |
213 | static char *delbuf; /* a (malloced) place to store deleted characters */ | 213 | static char *delbuf; /* a (malloced) place to store deleted characters */ |
214 | static char *delp; | 214 | static char *delp; |
@@ -224,7 +224,7 @@ static void input_delete(int save) | |||
224 | if (j == command_len) | 224 | if (j == command_len) |
225 | return; | 225 | return; |
226 | 226 | ||
227 | #if ENABLE_FEATURE_COMMAND_EDITING_VI | 227 | #if ENABLE_FEATURE_EDITING_VI |
228 | if (save) { | 228 | if (save) { |
229 | if (newdelflag) { | 229 | if (newdelflag) { |
230 | if (!delbuf) | 230 | if (!delbuf) |
@@ -245,7 +245,7 @@ static void input_delete(int save) | |||
245 | input_backward(cursor - j); /* back to old pos cursor */ | 245 | input_backward(cursor - j); /* back to old pos cursor */ |
246 | } | 246 | } |
247 | 247 | ||
248 | #if ENABLE_FEATURE_COMMAND_EDITING_VI | 248 | #if ENABLE_FEATURE_EDITING_VI |
249 | static void put(void) | 249 | static void put(void) |
250 | { | 250 | { |
251 | int ocursor; | 251 | int ocursor; |
@@ -280,7 +280,7 @@ static void input_forward(void) | |||
280 | } | 280 | } |
281 | 281 | ||
282 | 282 | ||
283 | #if ENABLE_FEATURE_COMMAND_TAB_COMPLETION | 283 | #if ENABLE_FEATURE_TAB_COMPLETION |
284 | 284 | ||
285 | static char **matches; | 285 | static char **matches; |
286 | static unsigned num_matches; | 286 | static unsigned num_matches; |
@@ -305,7 +305,7 @@ static void add_match(char *matched) | |||
305 | num_matches++; | 305 | num_matches++; |
306 | } | 306 | } |
307 | 307 | ||
308 | #if ENABLE_FEATURE_COMMAND_USERNAME_COMPLETION | 308 | #if ENABLE_FEATURE_USERNAME_COMPLETION |
309 | static void username_tab_completion(char *ud, char *with_shash_flg) | 309 | static void username_tab_completion(char *ud, char *with_shash_flg) |
310 | { | 310 | { |
311 | struct passwd *entry; | 311 | struct passwd *entry; |
@@ -431,7 +431,7 @@ static void exe_n_cwd_tab_completion(char *command, int type) | |||
431 | } else { | 431 | } else { |
432 | /* dirbuf = ".../.../.../" */ | 432 | /* dirbuf = ".../.../.../" */ |
433 | safe_strncpy(dirbuf, command, (pfind - command) + 2); | 433 | safe_strncpy(dirbuf, command, (pfind - command) + 2); |
434 | #if ENABLE_FEATURE_COMMAND_USERNAME_COMPLETION | 434 | #if ENABLE_FEATURE_USERNAME_COMPLETION |
435 | if (dirbuf[0] == '~') /* ~/... or ~user/... */ | 435 | if (dirbuf[0] == '~') /* ~/... or ~user/... */ |
436 | username_tab_completion(dirbuf, dirbuf); | 436 | username_tab_completion(dirbuf, dirbuf); |
437 | #endif | 437 | #endif |
@@ -749,7 +749,7 @@ static void input_tab(int *lastWasTab) | |||
749 | /* Free up any memory already allocated */ | 749 | /* Free up any memory already allocated */ |
750 | free_tab_completion_data(); | 750 | free_tab_completion_data(); |
751 | 751 | ||
752 | #if ENABLE_FEATURE_COMMAND_USERNAME_COMPLETION | 752 | #if ENABLE_FEATURE_USERNAME_COMPLETION |
753 | /* If the word starts with `~' and there is no slash in the word, | 753 | /* If the word starts with `~' and there is no slash in the word, |
754 | * then try completing this word as a username. */ | 754 | * then try completing this word as a username. */ |
755 | if (state->flags & USERNAME_COMPLETION) | 755 | if (state->flags & USERNAME_COMPLETION) |
@@ -874,7 +874,7 @@ static int get_next_history(void) | |||
874 | return 0; | 874 | return 0; |
875 | } | 875 | } |
876 | 876 | ||
877 | #if ENABLE_FEATURE_COMMAND_SAVEHISTORY | 877 | #if ENABLE_FEATURE_EDITING_SAVEHISTORY |
878 | /* state->flags is already checked to be nonzero */ | 878 | /* state->flags is already checked to be nonzero */ |
879 | void load_history(const char *fromfile) | 879 | void load_history(const char *fromfile) |
880 | { | 880 | { |
@@ -952,7 +952,7 @@ static void remember_in_history(const char *str) | |||
952 | state->cnt_history = i; | 952 | state->cnt_history = i; |
953 | if (state->flags & SAVE_HISTORY) | 953 | if (state->flags & SAVE_HISTORY) |
954 | save_history(state->hist_file); | 954 | save_history(state->hist_file); |
955 | USE_FEATURE_SH_FANCY_PROMPT(num_ok_lines++;) | 955 | USE_FEATURE_EDITING_FANCY_PROMPT(num_ok_lines++;) |
956 | } | 956 | } |
957 | 957 | ||
958 | #else /* MAX_HISTORY == 0 */ | 958 | #else /* MAX_HISTORY == 0 */ |
@@ -977,7 +977,7 @@ static void remember_in_history(const char *str) | |||
977 | * vi mode implemented 2005 by Paul Fox <pgf@foxharp.boston.ma.us> | 977 | * vi mode implemented 2005 by Paul Fox <pgf@foxharp.boston.ma.us> |
978 | */ | 978 | */ |
979 | 979 | ||
980 | #if ENABLE_FEATURE_COMMAND_EDITING_VI | 980 | #if ENABLE_FEATURE_EDITING_VI |
981 | static void | 981 | static void |
982 | vi_Word_motion(char *command, int eat) | 982 | vi_Word_motion(char *command, int eat) |
983 | { | 983 | { |
@@ -1076,7 +1076,7 @@ vi_back_motion(char *command) | |||
1076 | * read_line_input and its helpers | 1076 | * read_line_input and its helpers |
1077 | */ | 1077 | */ |
1078 | 1078 | ||
1079 | #if !ENABLE_FEATURE_SH_FANCY_PROMPT | 1079 | #if !ENABLE_FEATURE_EDITING_FANCY_PROMPT |
1080 | static void parse_prompt(const char *prmt_ptr) | 1080 | static void parse_prompt(const char *prmt_ptr) |
1081 | { | 1081 | { |
1082 | cmdedit_prompt = prmt_ptr; | 1082 | cmdedit_prompt = prmt_ptr; |
@@ -1246,7 +1246,7 @@ static void win_changed(int nsig) | |||
1246 | 1246 | ||
1247 | /* leave out the "vi-mode"-only case labels if vi editing isn't | 1247 | /* leave out the "vi-mode"-only case labels if vi editing isn't |
1248 | * configured. */ | 1248 | * configured. */ |
1249 | #define vi_case(caselabel) USE_FEATURE_COMMAND_EDITING(case caselabel) | 1249 | #define vi_case(caselabel) USE_FEATURE_EDITING(case caselabel) |
1250 | 1250 | ||
1251 | /* convert uppercase ascii to equivalent control char, for readability */ | 1251 | /* convert uppercase ascii to equivalent control char, for readability */ |
1252 | #undef CTRL | 1252 | #undef CTRL |
@@ -1260,7 +1260,7 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t | |||
1260 | unsigned int ic; | 1260 | unsigned int ic; |
1261 | unsigned char c; | 1261 | unsigned char c; |
1262 | smallint break_out = 0; | 1262 | smallint break_out = 0; |
1263 | #if ENABLE_FEATURE_COMMAND_EDITING_VI | 1263 | #if ENABLE_FEATURE_EDITING_VI |
1264 | smallint vi_cmdmode = 0; | 1264 | smallint vi_cmdmode = 0; |
1265 | smalluint prevc; | 1265 | smalluint prevc; |
1266 | #endif | 1266 | #endif |
@@ -1309,7 +1309,7 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t | |||
1309 | } | 1309 | } |
1310 | } | 1310 | } |
1311 | #endif | 1311 | #endif |
1312 | #if ENABLE_FEATURE_COMMAND_TAB_COMPLETION | 1312 | #if ENABLE_FEATURE_TAB_COMPLETION |
1313 | my_uid = getuid(); | 1313 | my_uid = getuid(); |
1314 | my_gid = getgid(); | 1314 | my_gid = getgid(); |
1315 | #endif | 1315 | #endif |
@@ -1326,7 +1326,7 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t | |||
1326 | 1326 | ||
1327 | ic = c; | 1327 | ic = c; |
1328 | 1328 | ||
1329 | #if ENABLE_FEATURE_COMMAND_EDITING_VI | 1329 | #if ENABLE_FEATURE_EDITING_VI |
1330 | newdelflag = 1; | 1330 | newdelflag = 1; |
1331 | if (vi_cmdmode) | 1331 | if (vi_cmdmode) |
1332 | ic |= vbit; | 1332 | ic |= vbit; |
@@ -1453,7 +1453,7 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t | |||
1453 | input_backspace(); | 1453 | input_backspace(); |
1454 | break; | 1454 | break; |
1455 | 1455 | ||
1456 | #if ENABLE_FEATURE_COMMAND_EDITING_VI | 1456 | #if ENABLE_FEATURE_EDITING_VI |
1457 | case 'i'|vbit: | 1457 | case 'i'|vbit: |
1458 | vi_cmdmode = 0; | 1458 | vi_cmdmode = 0; |
1459 | break; | 1459 | break; |
@@ -1584,7 +1584,7 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t | |||
1584 | 1584 | ||
1585 | case '\x1b': /* ESC */ | 1585 | case '\x1b': /* ESC */ |
1586 | 1586 | ||
1587 | #if ENABLE_FEATURE_COMMAND_EDITING_VI | 1587 | #if ENABLE_FEATURE_EDITING_VI |
1588 | if (state->flags & VI_MODE) { | 1588 | if (state->flags & VI_MODE) { |
1589 | /* ESC: insert mode --> command mode */ | 1589 | /* ESC: insert mode --> command mode */ |
1590 | vi_cmdmode = 1; | 1590 | vi_cmdmode = 1; |
@@ -1612,7 +1612,7 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t | |||
1612 | } | 1612 | } |
1613 | 1613 | ||
1614 | switch (c) { | 1614 | switch (c) { |
1615 | #if ENABLE_FEATURE_COMMAND_TAB_COMPLETION | 1615 | #if ENABLE_FEATURE_TAB_COMPLETION |
1616 | case '\t': /* Alt-Tab */ | 1616 | case '\t': /* Alt-Tab */ |
1617 | input_tab(&lastWasTab); | 1617 | input_tab(&lastWasTab); |
1618 | break; | 1618 | break; |
@@ -1679,7 +1679,7 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t | |||
1679 | } else | 1679 | } else |
1680 | #endif | 1680 | #endif |
1681 | 1681 | ||
1682 | #if ENABLE_FEATURE_COMMAND_EDITING_VI | 1682 | #if ENABLE_FEATURE_EDITING_VI |
1683 | if (vi_cmdmode) /* Don't self-insert */ | 1683 | if (vi_cmdmode) /* Don't self-insert */ |
1684 | break; | 1684 | break; |
1685 | #endif | 1685 | #endif |
@@ -1722,11 +1722,11 @@ int read_line_input(const char* prompt, char* command, int maxsize, line_input_t | |||
1722 | command[command_len] = '\0'; | 1722 | command[command_len] = '\0'; |
1723 | } | 1723 | } |
1724 | 1724 | ||
1725 | #if ENABLE_FEATURE_CLEAN_UP && ENABLE_FEATURE_COMMAND_TAB_COMPLETION | 1725 | #if ENABLE_FEATURE_CLEAN_UP && ENABLE_FEATURE_TAB_COMPLETION |
1726 | free_tab_completion_data(); | 1726 | free_tab_completion_data(); |
1727 | #endif | 1727 | #endif |
1728 | 1728 | ||
1729 | #if ENABLE_FEATURE_SH_FANCY_PROMPT | 1729 | #if ENABLE_FEATURE_EDITING_FANCY_PROMPT |
1730 | free((char*)cmdedit_prompt); | 1730 | free((char*)cmdedit_prompt); |
1731 | #endif | 1731 | #endif |
1732 | /* restore initial_settings */ | 1732 | /* restore initial_settings */ |
@@ -1772,7 +1772,7 @@ int main(int argc, char **argv) | |||
1772 | { | 1772 | { |
1773 | char buff[BUFSIZ]; | 1773 | char buff[BUFSIZ]; |
1774 | char *prompt = | 1774 | char *prompt = |
1775 | #if ENABLE_FEATURE_SH_FANCY_PROMPT | 1775 | #if ENABLE_FEATURE_EDITING_FANCY_PROMPT |
1776 | "\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:" | 1776 | "\\[\\033[32;1m\\]\\u@\\[\\x1b[33;1m\\]\\h:" |
1777 | "\\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] " | 1777 | "\\[\\033[34;1m\\]\\w\\[\\033[35;1m\\] " |
1778 | "\\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]"; | 1778 | "\\!\\[\\e[36;1m\\]\\$ \\[\\E[0m\\]"; |
diff --git a/shell/hush.c b/shell/hush.c index 2c88238ae..7e274324e 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -854,7 +854,7 @@ static int static_peek(struct in_str *i) | |||
854 | 854 | ||
855 | static void cmdedit_set_initial_prompt(void) | 855 | static void cmdedit_set_initial_prompt(void) |
856 | { | 856 | { |
857 | #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT | 857 | #if !ENABLE_FEATURE_EDITING_FANCY_PROMPT |
858 | PS1 = NULL; | 858 | PS1 = NULL; |
859 | #else | 859 | #else |
860 | PS1 = getenv("PS1"); | 860 | PS1 = getenv("PS1"); |
@@ -866,7 +866,7 @@ static void cmdedit_set_initial_prompt(void) | |||
866 | static void setup_prompt_string(int promptmode, char **prompt_str) | 866 | static void setup_prompt_string(int promptmode, char **prompt_str) |
867 | { | 867 | { |
868 | debug_printf("setup_prompt_string %d ",promptmode); | 868 | debug_printf("setup_prompt_string %d ",promptmode); |
869 | #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT | 869 | #if !ENABLE_FEATURE_EDITING_FANCY_PROMPT |
870 | /* Set up the prompt */ | 870 | /* Set up the prompt */ |
871 | if (promptmode == 1) { | 871 | if (promptmode == 1) { |
872 | free(PS1); | 872 | free(PS1); |
@@ -882,7 +882,7 @@ static void setup_prompt_string(int promptmode, char **prompt_str) | |||
882 | debug_printf("result %s\n",*prompt_str); | 882 | debug_printf("result %s\n",*prompt_str); |
883 | } | 883 | } |
884 | 884 | ||
885 | #if ENABLE_FEATURE_COMMAND_EDITING | 885 | #if ENABLE_FEATURE_EDITING |
886 | static line_input_t *line_input_state; | 886 | static line_input_t *line_input_state; |
887 | #endif | 887 | #endif |
888 | 888 | ||
@@ -892,7 +892,7 @@ static void get_user_input(struct in_str *i) | |||
892 | static char the_command[BUFSIZ]; | 892 | static char the_command[BUFSIZ]; |
893 | 893 | ||
894 | setup_prompt_string(i->promptmode, &prompt_str); | 894 | setup_prompt_string(i->promptmode, &prompt_str); |
895 | #if ENABLE_FEATURE_COMMAND_EDITING | 895 | #if ENABLE_FEATURE_EDITING |
896 | /* | 896 | /* |
897 | ** enable command line editing only while a command line | 897 | ** enable command line editing only while a command line |
898 | ** is actually being read; otherwise, we'll end up bequeathing | 898 | ** is actually being read; otherwise, we'll end up bequeathing |
@@ -1109,7 +1109,7 @@ static void pseudo_exec(struct child_prog *child) | |||
1109 | * really dislike relying on /proc for things. We could exec ourself | 1109 | * really dislike relying on /proc for things. We could exec ourself |
1110 | * from global_argv[0], but if we are in a chroot, we may not be able | 1110 | * from global_argv[0], but if we are in a chroot, we may not be able |
1111 | * to find ourself... */ | 1111 | * to find ourself... */ |
1112 | #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL | 1112 | #if ENABLE_FEATURE_SH_STANDALONE_SHELL |
1113 | { | 1113 | { |
1114 | int argc_l; | 1114 | int argc_l; |
1115 | char** argv_l=child->argv; | 1115 | char** argv_l=child->argv; |
@@ -2650,7 +2650,7 @@ int hush_main(int argc, char **argv) | |||
2650 | FILE *input; | 2650 | FILE *input; |
2651 | char **e = environ; | 2651 | char **e = environ; |
2652 | 2652 | ||
2653 | #ifdef CONFIG_FEATURE_COMMAND_EDITING | 2653 | #if ENABLE_FEATURE_EDITING |
2654 | line_input_state = new_line_input_t(FOR_SHELL); | 2654 | line_input_state = new_line_input_t(FOR_SHELL); |
2655 | #endif | 2655 | #endif |
2656 | 2656 | ||
@@ -2672,7 +2672,8 @@ int hush_main(int argc, char **argv) | |||
2672 | 2672 | ||
2673 | /* Initialize some more globals to non-zero values */ | 2673 | /* Initialize some more globals to non-zero values */ |
2674 | set_cwd(); | 2674 | set_cwd(); |
2675 | if (ENABLE_FEATURE_COMMAND_EDITING) cmdedit_set_initial_prompt(); | 2675 | if (ENABLE_FEATURE_EDITING) |
2676 | cmdedit_set_initial_prompt(); | ||
2676 | else PS1 = NULL; | 2677 | else PS1 = NULL; |
2677 | PS2 = "> "; | 2678 | PS2 = "> "; |
2678 | 2679 | ||
@@ -2738,7 +2739,7 @@ int hush_main(int argc, char **argv) | |||
2738 | debug_printf("\ninteractive=%d\n", interactive); | 2739 | debug_printf("\ninteractive=%d\n", interactive); |
2739 | if (interactive) { | 2740 | if (interactive) { |
2740 | /* Looks like they want an interactive shell */ | 2741 | /* Looks like they want an interactive shell */ |
2741 | #ifndef CONFIG_FEATURE_SH_EXTRA_QUIET | 2742 | #if !ENABLE_FEATURE_SH_EXTRA_QUIET |
2742 | printf( "\n\n%s hush - the humble shell v0.01 (testing)\n", | 2743 | printf( "\n\n%s hush - the humble shell v0.01 (testing)\n", |
2743 | BB_BANNER); | 2744 | BB_BANNER); |
2744 | printf( "Enter 'help' for a list of built-in commands.\n\n"); | 2745 | printf( "Enter 'help' for a list of built-in commands.\n\n"); |
@@ -2757,7 +2758,7 @@ int hush_main(int argc, char **argv) | |||
2757 | input = xfopen(argv[optind], "r"); | 2758 | input = xfopen(argv[optind], "r"); |
2758 | opt = parse_file_outer(input); | 2759 | opt = parse_file_outer(input); |
2759 | 2760 | ||
2760 | #ifdef CONFIG_FEATURE_CLEAN_UP | 2761 | #if ENABLE_FEATURE_CLEAN_UP |
2761 | fclose(input); | 2762 | fclose(input); |
2762 | if (cwd && cwd != bb_msg_unknown) | 2763 | if (cwd && cwd != bb_msg_unknown) |
2763 | free((char*)cwd); | 2764 | free((char*)cwd); |
diff --git a/shell/lash.c b/shell/lash.c index a09a9a9b1..4ea4e6763 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -365,7 +365,7 @@ static int builtin_export(struct child_prog *child) | |||
365 | res = putenv(v); | 365 | res = putenv(v); |
366 | if (res) | 366 | if (res) |
367 | bb_perror_msg("export"); | 367 | bb_perror_msg("export"); |
368 | #ifdef CONFIG_FEATURE_SH_FANCY_PROMPT | 368 | #ifdef CONFIG_FEATURE_EDITING_FANCY_PROMPT |
369 | if (strncmp(v, "PS1=", 4)==0) | 369 | if (strncmp(v, "PS1=", 4)==0) |
370 | PS1 = getenv("PS1"); | 370 | PS1 = getenv("PS1"); |
371 | #endif | 371 | #endif |
@@ -613,7 +613,7 @@ static inline void restore_redirects(int squirrel[]) | |||
613 | 613 | ||
614 | static inline void cmdedit_set_initial_prompt(void) | 614 | static inline void cmdedit_set_initial_prompt(void) |
615 | { | 615 | { |
616 | #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT | 616 | #if !ENABLE_FEATURE_EDITING_FANCY_PROMPT |
617 | PS1 = NULL; | 617 | PS1 = NULL; |
618 | #else | 618 | #else |
619 | PS1 = getenv("PS1"); | 619 | PS1 = getenv("PS1"); |
@@ -624,7 +624,7 @@ static inline void cmdedit_set_initial_prompt(void) | |||
624 | 624 | ||
625 | static inline void setup_prompt_string(char **prompt_str) | 625 | static inline void setup_prompt_string(char **prompt_str) |
626 | { | 626 | { |
627 | #ifndef CONFIG_FEATURE_SH_FANCY_PROMPT | 627 | #if !ENABLE_FEATURE_EDITING_FANCY_PROMPT |
628 | /* Set up the prompt */ | 628 | /* Set up the prompt */ |
629 | if (shell_context == 0) { | 629 | if (shell_context == 0) { |
630 | free(PS1); | 630 | free(PS1); |
@@ -639,7 +639,7 @@ static inline void setup_prompt_string(char **prompt_str) | |||
639 | #endif | 639 | #endif |
640 | } | 640 | } |
641 | 641 | ||
642 | #if ENABLE_FEATURE_COMMAND_EDITING | 642 | #if ENABLE_FEATURE_EDITING |
643 | static line_input_t *line_input_state; | 643 | static line_input_t *line_input_state; |
644 | #endif | 644 | #endif |
645 | 645 | ||
@@ -661,7 +661,7 @@ static int get_command(FILE * source, char *command) | |||
661 | if (source == stdin) { | 661 | if (source == stdin) { |
662 | setup_prompt_string(&prompt_str); | 662 | setup_prompt_string(&prompt_str); |
663 | 663 | ||
664 | #if ENABLE_FEATURE_COMMAND_EDITING | 664 | #if ENABLE_FEATURE_EDITING |
665 | /* | 665 | /* |
666 | ** enable command line editing only while a command line | 666 | ** enable command line editing only while a command line |
667 | ** is actually being read; otherwise, we'll end up bequeathing | 667 | ** is actually being read; otherwise, we'll end up bequeathing |
@@ -1507,7 +1507,7 @@ int lash_main(int argc_l, char **argv_l) | |||
1507 | argc = argc_l; | 1507 | argc = argc_l; |
1508 | argv = argv_l; | 1508 | argv = argv_l; |
1509 | 1509 | ||
1510 | #if ENABLE_FEATURE_COMMAND_EDITING | 1510 | #if ENABLE_FEATURE_EDITING |
1511 | line_input_state = new_line_input_t(FOR_SHELL); | 1511 | line_input_state = new_line_input_t(FOR_SHELL); |
1512 | #endif | 1512 | #endif |
1513 | 1513 | ||
@@ -1572,7 +1572,7 @@ int lash_main(int argc_l, char **argv_l) | |||
1572 | 1572 | ||
1573 | if (ENABLE_FEATURE_CLEAN_UP) atexit(free_memory); | 1573 | if (ENABLE_FEATURE_CLEAN_UP) atexit(free_memory); |
1574 | 1574 | ||
1575 | if (ENABLE_FEATURE_COMMAND_EDITING) cmdedit_set_initial_prompt(); | 1575 | if (ENABLE_FEATURE_EDITING) cmdedit_set_initial_prompt(); |
1576 | else PS1 = NULL; | 1576 | else PS1 = NULL; |
1577 | 1577 | ||
1578 | return (busy_loop(input)); | 1578 | return (busy_loop(input)); |
diff --git a/shell/msh.c b/shell/msh.c index 8746e42bc..15ce9ffdd 100644 --- a/shell/msh.c +++ b/shell/msh.c | |||
@@ -58,7 +58,7 @@ int mshdbg_rc = 0; | |||
58 | #endif /* MSHDEBUG */ | 58 | #endif /* MSHDEBUG */ |
59 | 59 | ||
60 | 60 | ||
61 | #ifdef CONFIG_FEATURE_SH_FANCY_PROMPT | 61 | #if ENABLE_FEATURE_EDITING_FANCY_PROMPT |
62 | # define DEFAULT_ROOT_PROMPT "\\u:\\w> " | 62 | # define DEFAULT_ROOT_PROMPT "\\u:\\w> " |
63 | # define DEFAULT_USER_PROMPT "\\u:\\w$ " | 63 | # define DEFAULT_USER_PROMPT "\\u:\\w$ " |
64 | #else | 64 | #else |
@@ -776,7 +776,7 @@ void print_tree(struct op *head) | |||
776 | #endif /* MSHDEBUG */ | 776 | #endif /* MSHDEBUG */ |
777 | 777 | ||
778 | 778 | ||
779 | #if ENABLE_FEATURE_COMMAND_EDITING | 779 | #if ENABLE_FEATURE_EDITING |
780 | static char *current_prompt; | 780 | static char *current_prompt; |
781 | #endif | 781 | #endif |
782 | 782 | ||
@@ -786,7 +786,7 @@ static char *current_prompt; | |||
786 | */ | 786 | */ |
787 | 787 | ||
788 | 788 | ||
789 | #if ENABLE_FEATURE_COMMAND_EDITING | 789 | #if ENABLE_FEATURE_EDITING |
790 | static line_input_t *line_input_state; | 790 | static line_input_t *line_input_state; |
791 | #endif | 791 | #endif |
792 | 792 | ||
@@ -798,7 +798,7 @@ int msh_main(int argc, char **argv) | |||
798 | char *name, **ap; | 798 | char *name, **ap; |
799 | int (*iof) (struct ioarg *); | 799 | int (*iof) (struct ioarg *); |
800 | 800 | ||
801 | #if ENABLE_FEATURE_COMMAND_EDITING | 801 | #if ENABLE_FEATURE_EDITING |
802 | line_input_state = new_line_input_t(FOR_SHELL); | 802 | line_input_state = new_line_input_t(FOR_SHELL); |
803 | #endif | 803 | #endif |
804 | 804 | ||
@@ -847,7 +847,7 @@ int msh_main(int argc, char **argv) | |||
847 | #endif | 847 | #endif |
848 | 848 | ||
849 | prompt = lookup("PS1"); | 849 | prompt = lookup("PS1"); |
850 | #ifdef CONFIG_FEATURE_SH_FANCY_PROMPT | 850 | #if ENABLE_FEATURE_EDITING_FANCY_PROMPT |
851 | if (prompt->value == null) | 851 | if (prompt->value == null) |
852 | #endif | 852 | #endif |
853 | setval(prompt, DEFAULT_USER_PROMPT); | 853 | setval(prompt, DEFAULT_USER_PROMPT); |
@@ -856,7 +856,7 @@ int msh_main(int argc, char **argv) | |||
856 | prompt->status &= ~EXPORT; | 856 | prompt->status &= ~EXPORT; |
857 | } | 857 | } |
858 | cprompt = lookup("PS2"); | 858 | cprompt = lookup("PS2"); |
859 | #ifdef CONFIG_FEATURE_SH_FANCY_PROMPT | 859 | #if ENABLE_FEATURE_EDITING_FANCY_PROMPT |
860 | if (cprompt->value == null) | 860 | if (cprompt->value == null) |
861 | #endif | 861 | #endif |
862 | setval(cprompt, "> "); | 862 | setval(cprompt, "> "); |
@@ -929,7 +929,7 @@ int msh_main(int argc, char **argv) | |||
929 | PUSHIO(afile, 0, iof); | 929 | PUSHIO(afile, 0, iof); |
930 | if (isatty(0) && isatty(1) && !cflag) { | 930 | if (isatty(0) && isatty(1) && !cflag) { |
931 | interactive++; | 931 | interactive++; |
932 | #ifndef CONFIG_FEATURE_SH_EXTRA_QUIET | 932 | #if !ENABLE_FEATURE_SH_EXTRA_QUIET |
933 | #ifdef MSHDEBUG | 933 | #ifdef MSHDEBUG |
934 | printf("\n\n%s Built-in shell (msh with debug)\n", BB_BANNER); | 934 | printf("\n\n%s Built-in shell (msh with debug)\n", BB_BANNER); |
935 | #else | 935 | #else |
@@ -971,7 +971,7 @@ int msh_main(int argc, char **argv) | |||
971 | 971 | ||
972 | for (;;) { | 972 | for (;;) { |
973 | if (interactive && e.iop <= iostack) { | 973 | if (interactive && e.iop <= iostack) { |
974 | #if ENABLE_FEATURE_COMMAND_EDITING | 974 | #if ENABLE_FEATURE_EDITING |
975 | current_prompt = prompt->value; | 975 | current_prompt = prompt->value; |
976 | #else | 976 | #else |
977 | prs(prompt->value); | 977 | prs(prompt->value); |
@@ -2378,7 +2378,7 @@ static int yylex(int cf) | |||
2378 | startl = 1; | 2378 | startl = 1; |
2379 | if (multiline || cf & CONTIN) { | 2379 | if (multiline || cf & CONTIN) { |
2380 | if (interactive && e.iop <= iostack) { | 2380 | if (interactive && e.iop <= iostack) { |
2381 | #if ENABLE_FEATURE_COMMAND_EDITING | 2381 | #if ENABLE_FEATURE_EDITING |
2382 | current_prompt = cprompt->value; | 2382 | current_prompt = cprompt->value; |
2383 | #else | 2383 | #else |
2384 | prs(cprompt->value); | 2384 | prs(cprompt->value); |
@@ -2439,7 +2439,7 @@ static int collect(int c, int c1) | |||
2439 | return YYERRCODE; | 2439 | return YYERRCODE; |
2440 | } | 2440 | } |
2441 | if (interactive && c == '\n' && e.iop <= iostack) { | 2441 | if (interactive && c == '\n' && e.iop <= iostack) { |
2442 | #if ENABLE_FEATURE_COMMAND_EDITING | 2442 | #if ENABLE_FEATURE_EDITING |
2443 | current_prompt = cprompt->value; | 2443 | current_prompt = cprompt->value; |
2444 | #else | 2444 | #else |
2445 | prs(cprompt->value); | 2445 | prs(cprompt->value); |
@@ -3289,7 +3289,7 @@ static int dohelp(struct op *t) | |||
3289 | col = 0; | 3289 | col = 0; |
3290 | } | 3290 | } |
3291 | } | 3291 | } |
3292 | #ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL | 3292 | #if ENABLE_FEATURE_SH_STANDALONE_SHELL |
3293 | { | 3293 | { |
3294 | int i; | 3294 | int i; |
3295 | const struct BB_applet *applet; | 3295 | const struct BB_applet *applet; |
@@ -4673,7 +4673,7 @@ static int readc(void) | |||
4673 | return e.iop->prev = 0; | 4673 | return e.iop->prev = 0; |
4674 | } | 4674 | } |
4675 | if (interactive && e.iop == iostack + 1) { | 4675 | if (interactive && e.iop == iostack + 1) { |
4676 | #if ENABLE_FEATURE_COMMAND_EDITING | 4676 | #if ENABLE_FEATURE_EDITING |
4677 | current_prompt = prompt->value; | 4677 | current_prompt = prompt->value; |
4678 | #else | 4678 | #else |
4679 | prs(prompt->value); | 4679 | prs(prompt->value); |
@@ -4905,7 +4905,7 @@ static int filechar(struct ioarg *ap) | |||
4905 | ap->afpos++; | 4905 | ap->afpos++; |
4906 | return *bp->bufp++ & 0177; | 4906 | return *bp->bufp++ & 0177; |
4907 | } | 4907 | } |
4908 | #if ENABLE_FEATURE_COMMAND_EDITING | 4908 | #if ENABLE_FEATURE_EDITING |
4909 | if (interactive && isatty(ap->afile)) { | 4909 | if (interactive && isatty(ap->afile)) { |
4910 | static char mycommand[BUFSIZ]; | 4910 | static char mycommand[BUFSIZ]; |
4911 | static int position = 0, size = 0; | 4911 | static int position = 0, size = 0; |
@@ -5156,7 +5156,7 @@ static void readhere(char **name, char *s, int ec) | |||
5156 | e.iobase = e.iop; | 5156 | e.iobase = e.iop; |
5157 | for (;;) { | 5157 | for (;;) { |
5158 | if (interactive && e.iop <= iostack) { | 5158 | if (interactive && e.iop <= iostack) { |
5159 | #if ENABLE_FEATURE_COMMAND_EDITING | 5159 | #if ENABLE_FEATURE_EDITING |
5160 | current_prompt = cprompt->value; | 5160 | current_prompt = cprompt->value; |
5161 | #else | 5161 | #else |
5162 | prs(cprompt->value); | 5162 | prs(cprompt->value); |