aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-03-26 14:06:56 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-03-26 14:06:56 +0100
commit19158a837df5093a2d655536424412bac2b07467 (patch)
tree3f3ce9c808e05dbf8dd38292f4c2db52cb73b429 /libbb/lineedit.c
parentaa167556cd2954bb9a9fb0a005178462087a4600 (diff)
downloadbusybox-w32-19158a837df5093a2d655536424412bac2b07467.tar.gz
busybox-w32-19158a837df5093a2d655536424412bac2b07467.tar.bz2
busybox-w32-19158a837df5093a2d655536424412bac2b07467.zip
unicode: s/FEATURE_ASSUME_UNICODE/UNICODE_SUPPORT, add UNICODE_USING_LOCALE
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 38a09cb26..dc90846f9 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -67,7 +67,7 @@
67 67
68 68
69#undef CHAR_T 69#undef CHAR_T
70#if ENABLE_FEATURE_ASSUME_UNICODE 70#if ENABLE_UNICODE_SUPPORT
71# define BB_NUL L'\0' 71# define BB_NUL L'\0'
72# define CHAR_T wchar_t 72# define CHAR_T wchar_t
73static bool BB_isspace(CHAR_T c) { return ((unsigned)c < 256 && isspace(c)); } 73static bool BB_isspace(CHAR_T c) { return ((unsigned)c < 256 && isspace(c)); }
@@ -202,7 +202,7 @@ static void deinit_S(void)
202#define DEINIT_S() deinit_S() 202#define DEINIT_S() deinit_S()
203 203
204 204
205#if ENABLE_FEATURE_ASSUME_UNICODE 205#if ENABLE_UNICODE_SUPPORT
206static size_t load_string(const char *src, int maxsize) 206static size_t load_string(const char *src, int maxsize)
207{ 207{
208 ssize_t len = mbstowcs(command_ps, src, maxsize - 1); 208 ssize_t len = mbstowcs(command_ps, src, maxsize - 1);
@@ -932,7 +932,7 @@ static void input_tab(smallint *lastWasTab)
932#define matchBuf (S.input_tab__matchBuf) 932#define matchBuf (S.input_tab__matchBuf)
933 int find_type; 933 int find_type;
934 int recalc_pos; 934 int recalc_pos;
935#if ENABLE_FEATURE_ASSUME_UNICODE 935#if ENABLE_UNICODE_SUPPORT
936 /* cursor pos in command converted to multibyte form */ 936 /* cursor pos in command converted to multibyte form */
937 int cursor_mb; 937 int cursor_mb;
938#endif 938#endif
@@ -942,7 +942,7 @@ static void input_tab(smallint *lastWasTab)
942 /* Make a local copy of the string -- 942 /* Make a local copy of the string --
943 * up to the position of the cursor */ 943 * up to the position of the cursor */
944 save_string(matchBuf, cursor + 1); 944 save_string(matchBuf, cursor + 1);
945#if ENABLE_FEATURE_ASSUME_UNICODE 945#if ENABLE_UNICODE_SUPPORT
946 cursor_mb = strlen(matchBuf); 946 cursor_mb = strlen(matchBuf);
947#endif 947#endif
948 tmp = matchBuf; 948 tmp = matchBuf;
@@ -1015,7 +1015,7 @@ static void input_tab(smallint *lastWasTab)
1015 } 1015 }
1016 1016
1017 len_found = strlen(tmp); 1017 len_found = strlen(tmp);
1018#if !ENABLE_FEATURE_ASSUME_UNICODE 1018#if !ENABLE_UNICODE_SUPPORT
1019 /* have space to place the match? */ 1019 /* have space to place the match? */
1020 /* The result consists of three parts with these lengths: */ 1020 /* The result consists of three parts with these lengths: */
1021 /* (cursor - recalc_pos) + len_found + (command_len - cursor) */ 1021 /* (cursor - recalc_pos) + len_found + (command_len - cursor) */
@@ -1088,7 +1088,7 @@ static void save_command_ps_at_cur_history(void)
1088 int cur = state->cur_history; 1088 int cur = state->cur_history;
1089 free(state->history[cur]); 1089 free(state->history[cur]);
1090 1090
1091# if ENABLE_FEATURE_ASSUME_UNICODE 1091# if ENABLE_UNICODE_SUPPORT
1092 { 1092 {
1093 char tbuf[MAX_LINELEN]; 1093 char tbuf[MAX_LINELEN];
1094 save_string(tbuf, sizeof(tbuf)); 1094 save_string(tbuf, sizeof(tbuf));
@@ -1659,7 +1659,7 @@ static int lineedit_read_key(char *read_key_buffer)
1659{ 1659{
1660 int64_t ic; 1660 int64_t ic;
1661 int timeout = -1; 1661 int timeout = -1;
1662#if ENABLE_FEATURE_ASSUME_UNICODE 1662#if ENABLE_UNICODE_SUPPORT
1663 char unicode_buf[MB_CUR_MAX + 1]; 1663 char unicode_buf[MB_CUR_MAX + 1];
1664 int unicode_idx = 0; 1664 int unicode_idx = 0;
1665#endif 1665#endif
@@ -1674,7 +1674,7 @@ static int lineedit_read_key(char *read_key_buffer)
1674 */ 1674 */
1675 ic = read_key(STDIN_FILENO, read_key_buffer, timeout); 1675 ic = read_key(STDIN_FILENO, read_key_buffer, timeout);
1676 if (errno) { 1676 if (errno) {
1677#if ENABLE_FEATURE_ASSUME_UNICODE 1677#if ENABLE_UNICODE_SUPPORT
1678 if (errno == EAGAIN && unicode_idx != 0) 1678 if (errno == EAGAIN && unicode_idx != 0)
1679 goto pushback; 1679 goto pushback;
1680#endif 1680#endif
@@ -1700,7 +1700,7 @@ static int lineedit_read_key(char *read_key_buffer)
1700 } 1700 }
1701#endif 1701#endif
1702 1702
1703#if ENABLE_FEATURE_ASSUME_UNICODE 1703#if ENABLE_UNICODE_SUPPORT
1704 if (unicode_status == UNICODE_ON) { 1704 if (unicode_status == UNICODE_ON) {
1705 wchar_t wc; 1705 wchar_t wc;
1706 1706
@@ -1817,7 +1817,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
1817 /* prepare before init handlers */ 1817 /* prepare before init handlers */
1818 cmdedit_y = 0; /* quasireal y, not true if line > xt*yt */ 1818 cmdedit_y = 0; /* quasireal y, not true if line > xt*yt */
1819 command_len = 0; 1819 command_len = 0;
1820#if ENABLE_FEATURE_ASSUME_UNICODE 1820#if ENABLE_UNICODE_SUPPORT
1821 command_ps = xzalloc(maxsize * sizeof(command_ps[0])); 1821 command_ps = xzalloc(maxsize * sizeof(command_ps[0]));
1822#else 1822#else
1823 command_ps = command; 1823 command_ps = command;
@@ -2199,8 +2199,8 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
2199// } 2199// }
2200// } 2200// }
2201 if (ic < ' ' 2201 if (ic < ' '
2202 || (!ENABLE_FEATURE_ASSUME_UNICODE && ic >= 256) 2202 || (!ENABLE_UNICODE_SUPPORT && ic >= 256)
2203 || (ENABLE_FEATURE_ASSUME_UNICODE && ic >= VI_CMDMODE_BIT) 2203 || (ENABLE_UNICODE_SUPPORT && ic >= VI_CMDMODE_BIT)
2204 ) { 2204 ) {
2205 /* If VI_CMDMODE_BIT is set, ic is >= 256 2205 /* If VI_CMDMODE_BIT is set, ic is >= 256
2206 * and vi mode ignores unexpected chars. 2206 * and vi mode ignores unexpected chars.
@@ -2268,7 +2268,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
2268/* Stop bug catching using "command_must_not_be_used" trick */ 2268/* Stop bug catching using "command_must_not_be_used" trick */
2269#undef command 2269#undef command
2270 2270
2271#if ENABLE_FEATURE_ASSUME_UNICODE 2271#if ENABLE_UNICODE_SUPPORT
2272 command[0] = '\0'; 2272 command[0] = '\0';
2273 if (command_len > 0) 2273 if (command_len > 0)
2274 command_len = save_string(command, maxsize - 1); 2274 command_len = save_string(command, maxsize - 1);