diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-11 21:36:13 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-11 21:36:13 +0200 |
commit | 42a8fd0db08ab8b45fec6eab4af841f99576b260 (patch) | |
tree | 55f0600298da0c83c638c985d0c8b6d803be926b /libbb/lineedit.c | |
parent | 883cea47518a171ab83f8e41def3aec92207519e (diff) | |
download | busybox-w32-42a8fd0db08ab8b45fec6eab4af841f99576b260.tar.gz busybox-w32-42a8fd0db08ab8b45fec6eab4af841f99576b260.tar.bz2 busybox-w32-42a8fd0db08ab8b45fec6eab4af841f99576b260.zip |
added simplified Unicode support for non-locale-enabled builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r-- | libbb/lineedit.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index e5d0c1b6c..ab3297220 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -34,10 +34,7 @@ | |||
34 | * PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' | 34 | * PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' |
35 | */ | 35 | */ |
36 | #include "libbb.h" | 36 | #include "libbb.h" |
37 | #if ENABLE_FEATURE_ASSUME_UNICODE | 37 | #include "unicode.h" |
38 | # include <wchar.h> | ||
39 | # include <wctype.h> | ||
40 | #endif | ||
41 | 38 | ||
42 | /* FIXME: obsolete CONFIG item? */ | 39 | /* FIXME: obsolete CONFIG item? */ |
43 | #define ENABLE_FEATURE_NONPRINTABLE_INVERSE_PUT 0 | 40 | #define ENABLE_FEATURE_NONPRINTABLE_INVERSE_PUT 0 |
@@ -1581,7 +1578,7 @@ static int lineedit_read_key(char *read_key_buffer) | |||
1581 | return ic; | 1578 | return ic; |
1582 | unicode_buf[unicode_idx++] = ic; | 1579 | unicode_buf[unicode_idx++] = ic; |
1583 | unicode_buf[unicode_idx] = '\0'; | 1580 | unicode_buf[unicode_idx] = '\0'; |
1584 | if (mbstowcs(&wc, unicode_buf, 1) < 1 && unicode_idx < MB_CUR_MAX) { | 1581 | if (mbstowcs(&wc, unicode_buf, 1) != 1 && unicode_idx < MB_CUR_MAX) { |
1585 | delay = 50; | 1582 | delay = 50; |
1586 | goto poll_again; | 1583 | goto poll_again; |
1587 | } | 1584 | } |
@@ -1636,6 +1633,8 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
1636 | return len; | 1633 | return len; |
1637 | } | 1634 | } |
1638 | 1635 | ||
1636 | check_unicode_in_env(); | ||
1637 | |||
1639 | // FIXME: audit & improve this | 1638 | // FIXME: audit & improve this |
1640 | if (maxsize > MAX_LINELEN) | 1639 | if (maxsize > MAX_LINELEN) |
1641 | maxsize = MAX_LINELEN; | 1640 | maxsize = MAX_LINELEN; |