On Monday 14 January 2008 16:57, Paul Fox wrote:
> i'm just re-reading this message, which i didn't pay attention to before.
> 
>  > I tried to use FEATURE_VI_8BIT in busybox 1.9.0 bus was unsuccessful so
>  > far. Even though this feature is enabled in my configuration, I can't
>  > enter german umlauts into vi.
> 
> ...
>  > int main(int argc, char **argv)
>  > {
>  >   unsigned int x;
>  >   while(1) {
>  >     x = getc(stdin);
>  >     if(isprint(x))
>  >     {
>  >       printf("%c is printable\n", x);
>  >     } else {
>  >       printf("%c is not printable\n", x);
>  >     }
>  >   }
>  >   return 0;
>  > }
>  > - ----------------------------- 8< ------------------------
>  > 
>  > Needless to say, it always prints out the "is not printable" text
>  > for all umlauts I enter.
>  > 
>  > Am I doing something wrong or is this a bug?
> 
> is your locale set correctly?  if busybox is built to honor your
> locale, then i'm surprised that the umlaut isn't "printable".
> 
> (in fact, this makes me wonder if my fix to lineedit.c was correct.)

Alexander, with ENABLE_LOCALE_SUPPORT off and ENABLE_FEATURE_VI_8BIT on,
vi shall accept everything above 31 which is not x7f and not 0x9b:

#if ENABLE_LOCALE_SUPPORT

#if ENABLE_FEATURE_VI_8BIT
#define Isprint(c) isprint(c)
#else
#define Isprint(c) (isprint(c) && (unsigned char)(c) < 0x7f)
#endif

#else

/* 0x9b is Meta-ESC */
#if ENABLE_FEATURE_VI_8BIT
#define Isprint(c) ((unsigned char)(c) >= ' ' && (c) != 0x7f && (unsigned 
char)(c) != 0x9b)
#else
#define Isprint(c) ((unsigned char)(c) >= ' ' && (unsigned char)(c) < 0x7f)
#endif

#endif

Can you test that this combination works?

If yes, then it seems in your locale setup isprint() thinks that umlauts
are not printable chars.


P.S. Wonders of vi.c... what is this "if (1 <= (unsigned char)c || ...)"
check for? "If char is Ctrl-A or NUL" - ??

static void do_cmd(char c)
{
...
        if (cmd_mode == 2) {
...
                if (*dot == '\n') {...
                } else {
                        if (1 <= (unsigned char)c || Isprint(c)) {
                                if (c != 27)
                                        dot = yank_delete(dot, dot, 0, 
YANKDEL);        // delete char
                                dot = char_insert(dot, c);      // insert new 
char
                        }
                        goto dc1;
                }
        }
        if (cmd_mode == 1) {
                // hitting "Insert" twice means "R" replace mode
                if (c == VI_K_INSERT)
                        goto dc5;
                // insert the char c at "dot"
                if (1 <= (unsigned char)c || Isprint(c)) {
                        dot = char_insert(dot, c);
                }
                goto dc1;
        }
...

--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to