aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-02-16 20:09:17 +0000
committerEric Andersen <andersen@codepoet.org>2001-02-16 20:09:17 +0000
commit6faae7deb4b88dccffb7dbbf267315cb7bbc0af9 (patch)
tree550531e0e4027c69a6cca27fde31574c75e26104 /shell
parent361ee514c636b371a50554ab73a3bfd54a49804d (diff)
downloadbusybox-w32-6faae7deb4b88dccffb7dbbf267315cb7bbc0af9.tar.gz
busybox-w32-6faae7deb4b88dccffb7dbbf267315cb7bbc0af9.tar.bz2
busybox-w32-6faae7deb4b88dccffb7dbbf267315cb7bbc0af9.zip
Commit Vladimir's latest cmdedit. I modified it slightly to ensure
parse_prompt() would be called before cmdedit_init(), since cmdedit_init() calls cmdedit_setwidth() which uses cmdedit_prmt_len, which is set by parse_prompt(). Also, added a mod, so very narrow terminals should now wrap properly... This is working very nicely for me -- Vladimir has done some very good work.
Diffstat (limited to 'shell')
-rw-r--r--shell/cmdedit.c13
-rw-r--r--shell/lash.c3
2 files changed, 8 insertions, 8 deletions
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index 6a53c12f6..6fd80fd21 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -30,7 +30,7 @@
30 */ 30 */
31 31
32 32
33#define TEST 33//#define TEST
34 34
35 35
36#ifndef TEST 36#ifndef TEST
@@ -555,6 +555,9 @@ static void clean_up_and_die(int sig)
555static void cmdedit_setwidth(int w, int redraw_flg) 555static void cmdedit_setwidth(int w, int redraw_flg)
556{ 556{
557 cmdedit_termw = cmdedit_prmt_len + 2; 557 cmdedit_termw = cmdedit_prmt_len + 2;
558 if (w <= cmdedit_termw) {
559 cmdedit_termw = cmdedit_termw % w;
560 }
558 if (w > cmdedit_termw) { 561 if (w > cmdedit_termw) {
559 562
560 cmdedit_termw = w; 563 cmdedit_termw = w;
@@ -567,10 +570,7 @@ static void cmdedit_setwidth(int w, int redraw_flg)
567 redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), len - cursor); 570 redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), len - cursor);
568 fflush(stdout); 571 fflush(stdout);
569 } 572 }
570 } else { 573 }
571 error_msg("\n*** Error: minimum screen width is %d",
572 cmdedit_termw);
573 }
574} 574}
575 575
576extern void cmdedit_init(void) 576extern void cmdedit_init(void)
@@ -1234,9 +1234,10 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
1234 setTermSettings(inputFd, (void *) &new_settings); 1234 setTermSettings(inputFd, (void *) &new_settings);
1235 handlers_sets |= SET_RESET_TERM; 1235 handlers_sets |= SET_RESET_TERM;
1236 1236
1237 cmdedit_init();
1238 /* Print out the command prompt */ 1237 /* Print out the command prompt */
1239 parse_prompt(prompt); 1238 parse_prompt(prompt);
1239 /* Now initialize things */
1240 cmdedit_init();
1240 1241
1241 while (1) { 1242 while (1) {
1242 1243
diff --git a/shell/lash.c b/shell/lash.c
index 9519538dc..76ef16a55 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -854,10 +854,9 @@ static int get_command(FILE * source, char *command)
854 ** atexit() handlers and other unwanted stuff to our 854 ** atexit() handlers and other unwanted stuff to our
855 ** child processes (rob@sysgo.de) 855 ** child processes (rob@sysgo.de)
856 */ 856 */
857 cmdedit_init();
858 cmdedit_read_input(prompt_str, command); 857 cmdedit_read_input(prompt_str, command);
859 free(prompt_str);
860 cmdedit_terminate(); 858 cmdedit_terminate();
859 free(prompt_str);
861 return 0; 860 return 0;
862#else 861#else
863 fputs(prompt_str, stdout); 862 fputs(prompt_str, stdout);