hush in arm nommu environment
Per Hallsmark
per.hallsmark at t2data.se
Mon Aug 6 09:35:52 UTC 2007
well... sometimes one can answer oneself... :)
--- busybox-1.6.1.orig/libbb/lineedit.c 2007-06-30 17:06:40.000000000 +0200
+++ busybox-1.6.1/libbb/lineedit.c 2007-08-06 11:23:57.000000000 +0200
@@ -165,10 +165,12 @@
if (cmdedit_x >= num) {
cmdedit_x -= num;
+#if 0
if (num <= 4) {
printf("\b\b\b\b" + (4-num));
return;
}
+#endif
printf("\033[%uD", num);
return;
}
With above patch backspace works ok.
The \b\b... printf looks rather mystic... guess the author
perhaps wanted something like this instead?
switch (num) {
case 4:
printf("\b");
/* fall trough */
case 3:
printf("\b");
/* fall trough */
case 2:
printf("\b");
/* fall trough */
case 1:
printf("\b");
return;
default:
}
but I wonder what the benefits are...
Per Hallsmark wrote:
> Hi all,
>
> I've tried out the hush shell in busybox 1.6.1.
> Seems to work fairly well with the patch last in
> this mail.
>
> The only(?) thing that doesn't work however, is
> backspace... or to be more correct, it do backspace
> in the commandline but it isn't displayed correctly.
> If I have fancy editing enabling then the character
> is moved to the RIGHT instead of LEFT when I backspace.
> If I don't have fancy editing enabled, it prints out
> some garbage (same all time) like:
>
> ~ # lsUP!) UP!)UP!) UP!)
> (backspace pressed twice)
>
> The only string I can find that looks like UP!) is:
>
> [per at phlap3 busybox-1.6.1]$ grep -r UP\! *
> networking/ping.c: const char *dupmsg = " (DUP!)";
> [per at phlap3 busybox-1.6.1]$
>
> So it seems like a weird pointer issue...
>
> I use busybox 1.6.1, gcc 4.1.2 and kernel 2.6.19-uc1 on
> a arm7tdmi'ish mcu.
>
> Anyone encountered this behaviour?
>
> /Per
>
> --- busybox-1.6.1.orig/shell/hush.c 2007-06-30 17:06:37.000000000 +0200
> +++ busybox-1.6.1/shell/hush.c 2007-08-02 15:41:22.000000000 +0200
> @@ -658,7 +658,11 @@
> pid_t pid;
>
> debug_printf_jobs("got tty sig %d in pid %d\n", sig, getpid());
> +#if BB_MMU
> pid = fork();
> +#else
> + pid = vfork();
> +#endif
> if (pid < 0) /* can't fork. Pretend there was no ctrl-Z */
> return;
> ctrl_z_flag = 1;
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://busybox.net/cgi-bin/mailman/listinfo/busybox
More information about the busybox
mailing list