diff options
| author | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2006-01-25 17:53:04 +0000 |
|---|---|---|
| committer | "Vladimir N. Oleynik" <dzo@simtreas.ru> | 2006-01-25 17:53:04 +0000 |
| commit | 84005af7ef890418fa8558824439fa103da63d4e (patch) | |
| tree | 39c1a20ef49de01ebd3e3d60c066f722b2916dfa | |
| parent | 5775aa2ef6aa749409d98e996216a3b9d6a0f7a9 (diff) | |
| download | busybox-w32-84005af7ef890418fa8558824439fa103da63d4e.tar.gz busybox-w32-84005af7ef890418fa8558824439fa103da63d4e.tar.bz2 busybox-w32-84005af7ef890418fa8558824439fa103da63d4e.zip | |
C99 say: "char" declaration may be signed or unsigned default
| -rw-r--r-- | shell/ash.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/shell/ash.c b/shell/ash.c index 671069771..3564d850b 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -728,6 +728,9 @@ static const char *tokname(int tok) | |||
| 728 | #define is_name(c) ((c) == '_' || isalpha((unsigned char)(c))) | 728 | #define is_name(c) ((c) == '_' || isalpha((unsigned char)(c))) |
| 729 | #define is_in_name(c) ((c) == '_' || isalnum((unsigned char)(c))) | 729 | #define is_in_name(c) ((c) == '_' || isalnum((unsigned char)(c))) |
| 730 | 730 | ||
| 731 | /* C99 say: "char" declaration may be signed or unsigned default */ | ||
| 732 | #define SC2INT(chr2may_be_negative_int) (int)((signed char)chr2may_be_negative_int) | ||
| 733 | |||
| 731 | /* | 734 | /* |
| 732 | * is_special(c) evaluates to 1 for c in "!#$*-0123456789?@"; 0 otherwise | 735 | * is_special(c) evaluates to 1 for c in "!#$*-0123456789?@"; 0 otherwise |
| 733 | * (assuming ascii char codes, as the original implementation did) | 736 | * (assuming ascii char codes, as the original implementation did) |
| @@ -841,7 +844,7 @@ static int SIT(int c, int syntax) | |||
| 841 | return S_I_T[indx][syntax]; | 844 | return S_I_T[indx][syntax]; |
| 842 | } | 845 | } |
| 843 | 846 | ||
| 844 | #else /* USE_SIT_FUNCTION */ | 847 | #else /* USE_SIT_FUNCTION */ |
| 845 | 848 | ||
| 846 | #define SIT(c, syntax) S_I_T[(int)syntax_index_table[((int)c)+SYNBASE]][syntax] | 849 | #define SIT(c, syntax) S_I_T[(int)syntax_index_table[((int)c)+SYNBASE]][syntax] |
| 847 | 850 | ||
| @@ -5244,7 +5247,7 @@ memtodest(const char *p, size_t len, int syntax, int quotes) { | |||
| 5244 | q = makestrspace(len * 2, q); | 5247 | q = makestrspace(len * 2, q); |
| 5245 | 5248 | ||
| 5246 | while (len--) { | 5249 | while (len--) { |
| 5247 | int c = *p++; | 5250 | int c = SC2INT(*p++); |
| 5248 | if (!c) | 5251 | if (!c) |
| 5249 | continue; | 5252 | continue; |
| 5250 | if (quotes && (SIT(c, syntax) == CCTL || SIT(c, syntax) == CBACK)) | 5253 | if (quotes && (SIT(c, syntax) == CCTL || SIT(c, syntax) == CBACK)) |
| @@ -5318,7 +5321,7 @@ numvar: | |||
| 5318 | goto param; | 5321 | goto param; |
| 5319 | /* fall through */ | 5322 | /* fall through */ |
| 5320 | case '*': | 5323 | case '*': |
| 5321 | sep = ifsset() ? ifsval()[0] : ' '; | 5324 | sep = ifsset() ? SC2INT(ifsval()[0]) : ' '; |
| 5322 | if (quotes && (SIT(sep, syntax) == CCTL || SIT(sep, syntax) == CBACK)) | 5325 | if (quotes && (SIT(sep, syntax) == CCTL || SIT(sep, syntax) == CBACK)) |
| 5323 | sepq = 1; | 5326 | sepq = 1; |
| 5324 | param: | 5327 | param: |
| @@ -5920,7 +5923,8 @@ static void pushfile(void); | |||
| 5920 | * Nul characters in the input are silently discarded. | 5923 | * Nul characters in the input are silently discarded. |
| 5921 | */ | 5924 | */ |
| 5922 | 5925 | ||
| 5923 | #define pgetc_as_macro() (--parsenleft >= 0? *parsenextc++ : preadbuffer()) | 5926 | |
| 5927 | #define pgetc_as_macro() (--parsenleft >= 0? SC2INT(*parsenextc++) : preadbuffer()) | ||
| 5924 | 5928 | ||
| 5925 | #ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE | 5929 | #ifdef CONFIG_ASH_OPTIMIZE_FOR_SIZE |
| 5926 | #define pgetc_macro() pgetc() | 5930 | #define pgetc_macro() pgetc() |
| @@ -6085,7 +6089,7 @@ preadbuffer(void) | |||
| 6085 | #endif | 6089 | #endif |
| 6086 | popstring(); | 6090 | popstring(); |
| 6087 | if (--parsenleft >= 0) | 6091 | if (--parsenleft >= 0) |
| 6088 | return (*parsenextc++); | 6092 | return SC2INT(*parsenextc++); |
| 6089 | } | 6093 | } |
| 6090 | if (parsenleft == EOF_NLEFT || parsefile->buf == NULL) | 6094 | if (parsenleft == EOF_NLEFT || parsefile->buf == NULL) |
| 6091 | return PEOF; | 6095 | return PEOF; |
| @@ -6137,7 +6141,7 @@ again: | |||
| 6137 | 6141 | ||
| 6138 | *q = savec; | 6142 | *q = savec; |
| 6139 | 6143 | ||
| 6140 | return *parsenextc++; | 6144 | return SC2INT(*parsenextc++); |
| 6141 | } | 6145 | } |
| 6142 | 6146 | ||
| 6143 | /* | 6147 | /* |
| @@ -10195,13 +10199,11 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) | |||
| 10195 | if (doprompt) | 10199 | if (doprompt) |
| 10196 | setprompt(2); | 10200 | setprompt(2); |
| 10197 | } else { | 10201 | } else { |
| 10198 | if ( | 10202 | if (dblquote && |
| 10199 | dblquote && | ||
| 10200 | c != '\\' && c != '`' && | 10203 | c != '\\' && c != '`' && |
| 10201 | c != '$' && ( | 10204 | c != '$' && ( |
| 10202 | c != '"' || | 10205 | c != '"' || |
| 10203 | eofmark != NULL | 10206 | eofmark != NULL) |
| 10204 | ) | ||
| 10205 | ) { | 10207 | ) { |
| 10206 | USTPUTC(CTLESC, out); | 10208 | USTPUTC(CTLESC, out); |
| 10207 | USTPUTC('\\', out); | 10209 | USTPUTC('\\', out); |
