[BusyBox] New version - new patches
Vladimir N. Oleynik
dzo at simtreas.ru
Fri Mar 16 15:51:24 UTC 2001
Hi.
The miracle has come to pass, 50-I have appeared the version.
Now I patches shall fill up you :)
So.
1) Erik, at last, I have found a problem why you so do not like initialization
for prompt in cmdedit.
Look the beginning lines in patch.
At the same time, there small specification for Config.h
2) Reduce more.o 24 bytes.
3) Larry:
I have found a pair of mistakes in sh.c One could remove, another essentially
not eliminated because of your algorithm - double parsing escape '\'.
$ echo \7 Right
<Beep> Right
$ echo \07 False
<Beep>7 False
$ echo \
bla-bla
Segmentation failed :(
(in cmdedit, but this not my problem, erroneous usage free()? )
Also. Larry. Please remove your strange strpbrk! All chars [0-' '127-255] as
seperator
in latin-1 locale, but in other - addition problem. Please use isalpha + isdigit
+ '_'!
--w
vodz
-------------- next part --------------
diff -rbu busybox.orig/Config.h busybox/Config.h
--- busybox.orig/Config.h Thu Mar 15 21:58:06 2001
+++ busybox/Config.h Fri Mar 16 18:25:59 2001
@@ -355,11 +355,7 @@
#if defined BB_SH
#if defined BB_FEATURE_COMMAND_EDITING
#define BB_CMDEDIT
- #ifndef BB_FEATURE_USE_TERMIOS
- #define BB_FEATURE_USE_TERMIOS
- #endif
#else
- #undef BB_FEATURE_COMMAND_EDITING
#undef BB_FEATURE_COMMAND_TAB_COMPLETION
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
#define BB_FEATURE_SH_SIMPLE_PROMPT
diff -rbu busybox.orig/cmdedit.c busybox/cmdedit.c
--- busybox.orig/cmdedit.c Thu Mar 15 23:51:09 2001
+++ busybox/cmdedit.c Thu Mar 15 13:56:44 2001
@@ -560,11 +560,7 @@
static void cmdedit_setwidth(int w, int redraw_flg)
{
- cmdedit_termw = cmdedit_prmt_len + 2;
- if (w <= cmdedit_termw) {
- cmdedit_termw = cmdedit_termw % w;
- }
- if (w > cmdedit_termw) {
+ if (w > (cmdedit_prmt_len+2)) {
cmdedit_termw = w;
if (redraw_flg) {
@@ -580,6 +576,7 @@
extern void cmdedit_init(void)
{
+ cmdedit_prmt_len = 0;
if ((handlers_sets & SET_WCHG_HANDLERS) == 0) {
/* emulate usage handler to set handler and call yours work */
win_changed(-SIGWINCH);
diff -rbu busybox.orig/more.c busybox/more.c
--- busybox.orig/more.c Fri Feb 23 04:39:26 2001
+++ busybox/more.c Fri Mar 16 18:49:02 2001
@@ -154,12 +154,10 @@
#ifdef BB_FEATURE_USE_TERMIOS
/* Erase the "More" message */
- while (--len >= 0)
- putc('\b', stdout);
- while (++len <= terminal_width)
+ putc('\r', stdout);
+ while (--len <= 0)
putc(' ', stdout);
- while (--len >= 0)
- putc('\b', stdout);
+ putc('\r', stdout);
fflush(stdout);
#endif
len=0;
diff -rbu busybox.orig/sh.c busybox/sh.c
--- busybox.orig/sh.c Fri Mar 16 02:01:19 2001
+++ busybox/sh.c Fri Mar 16 18:18:44 2001
@@ -65,9 +65,9 @@
#include <unistd.h>
#include <getopt.h>
-#undef BB_FEATURE_SH_WORDEXP
+//#define BB_FEATURE_SH_WORDEXP
-#if BB_FEATURE_SH_WORDEXP
+#ifdef BB_FEATURE_SH_WORDEXP
#include <wordexp.h>
#define expand_t wordexp_t
#undef BB_FEATURE_SH_BACKTICKS
@@ -881,9 +881,6 @@
return 1;
}
- /* remove trailing newline */
- chomp(command);
-
return 0;
}
@@ -962,8 +959,17 @@
while( command && command[index]) {
if (command[index] == '\\') {
char *tmp = command+index+1;
- command[index+1] = process_escape_sequence( &tmp );
- memmove(command+index, command+index+1, strlen(command+index));
+ char rez;
+ rez = process_escape_sequence( &tmp );
+ if( rez != '\\' ) { /* for next parse \ */
+ command[index] = rez;
+ strcpy(command+index + 1, tmp);
+ index++;
+ } else {
+ /* skip \and_invalid_char_for_escape */
+ if(*tmp)
+ index++;
+ }
}
index++;
}
@@ -971,7 +977,7 @@
#ifdef BB_FEATURE_SH_ENVIRONMENT
-#if BB_FEATURE_SH_WORDEXP
+#ifdef BB_FEATURE_SH_WORDEXP
/* This first part uses wordexp() which is a wonderful C lib
* function which expands nearly everything. */
retval = wordexp (command, &expand_result, WRDE_SHOWERR);
More information about the busybox
mailing list