diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-15 11:26:36 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-12-15 11:26:36 +0000 |
commit | 68819d123211ead5354994663776298852577c29 (patch) | |
tree | 5887801c35b833f9ae32f5cbe2b8228aeb8a9029 | |
parent | 3139ea7f1567723e200d29e46e78953ea5fe4d5b (diff) | |
download | busybox-w32-68819d123211ead5354994663776298852577c29.tar.gz busybox-w32-68819d123211ead5354994663776298852577c29.tar.bz2 busybox-w32-68819d123211ead5354994663776298852577c29.zip |
ash: fix CONFIG_ASH_OPTIMIZE_FOR_SIZE off + high-bit chars case
(do we even need CONFIG_ASH_OPTIMIZE_FOR_SIZE conditional?)
-rw-r--r-- | shell/ash.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/shell/ash.c b/shell/ash.c index 2a71a2cf2..2fc903b37 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -2708,12 +2708,11 @@ SIT(int c, int syntax) | |||
2708 | && (unsigned char)c <= (unsigned char)(CTLQUOTEMARK) | 2708 | && (unsigned char)c <= (unsigned char)(CTLQUOTEMARK) |
2709 | ) { | 2709 | ) { |
2710 | return CCTL; | 2710 | return CCTL; |
2711 | } else { | ||
2712 | s = strchrnul(spec_symbls, c); | ||
2713 | if (*s == '\0') | ||
2714 | return CWORD; | ||
2715 | indx = syntax_index_table[s - spec_symbls]; | ||
2716 | } | 2711 | } |
2712 | s = strchrnul(spec_symbls, c); | ||
2713 | if (*s == '\0') | ||
2714 | return CWORD; | ||
2715 | indx = syntax_index_table[s - spec_symbls]; | ||
2717 | return S_I_T[indx][syntax]; | 2716 | return S_I_T[indx][syntax]; |
2718 | } | 2717 | } |
2719 | 2718 | ||
@@ -9290,6 +9289,12 @@ preadfd(void) | |||
9290 | */ | 9289 | */ |
9291 | //#define pgetc_debug(...) bb_error_msg(__VA_ARGS__) | 9290 | //#define pgetc_debug(...) bb_error_msg(__VA_ARGS__) |
9292 | #define pgetc_debug(...) ((void)0) | 9291 | #define pgetc_debug(...) ((void)0) |
9292 | /* | ||
9293 | * NB: due to SIT(c) internals (syntax_index_table[] vector), | ||
9294 | * pgetc() and related functions must return chars SIGN-EXTENDED into ints, | ||
9295 | * not zero-extended. Seems fragile to me. Affects only !USE_SIT_FUNCTION case, | ||
9296 | * so we can fix it by ditching !USE_SIT_FUNCTION if Unicode requires that. | ||
9297 | */ | ||
9293 | static int | 9298 | static int |
9294 | preadbuffer(void) | 9299 | preadbuffer(void) |
9295 | { | 9300 | { |
@@ -9390,12 +9395,12 @@ preadbuffer(void) | |||
9390 | g_parsefile->left_in_line, | 9395 | g_parsefile->left_in_line, |
9391 | g_parsefile->next_to_pgetc, | 9396 | g_parsefile->next_to_pgetc, |
9392 | g_parsefile->next_to_pgetc); | 9397 | g_parsefile->next_to_pgetc); |
9393 | return (unsigned char)(*g_parsefile->next_to_pgetc++); | 9398 | return signed_char2int(*g_parsefile->next_to_pgetc++); |
9394 | } | 9399 | } |
9395 | 9400 | ||
9396 | #define pgetc_as_macro() \ | 9401 | #define pgetc_as_macro() \ |
9397 | (--g_parsefile->left_in_line >= 0 \ | 9402 | (--g_parsefile->left_in_line >= 0 \ |
9398 | ? (unsigned char)(*g_parsefile->next_to_pgetc++) \ | 9403 | ? signed_char2int(*g_parsefile->next_to_pgetc++) \ |
9399 | : preadbuffer() \ | 9404 | : preadbuffer() \ |
9400 | ) | 9405 | ) |
9401 | 9406 | ||
@@ -10293,9 +10298,9 @@ fixredir(union node *n, const char *text, int err) | |||
10293 | * or backquotes). | 10298 | * or backquotes). |
10294 | */ | 10299 | */ |
10295 | static int | 10300 | static int |
10296 | noexpand(char *text) | 10301 | noexpand(const char *text) |
10297 | { | 10302 | { |
10298 | char *p; | 10303 | const char *p; |
10299 | char c; | 10304 | char c; |
10300 | 10305 | ||
10301 | p = text; | 10306 | p = text; |
@@ -10304,7 +10309,7 @@ noexpand(char *text) | |||
10304 | continue; | 10309 | continue; |
10305 | if (c == CTLESC) | 10310 | if (c == CTLESC) |
10306 | p++; | 10311 | p++; |
10307 | else if (SIT(c, BASESYNTAX) == CCTL) | 10312 | else if (SIT((signed char)c, BASESYNTAX) == CCTL) |
10308 | return 0; | 10313 | return 0; |
10309 | } | 10314 | } |
10310 | return 1; | 10315 | return 1; |