diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-07 09:53:50 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-07 09:53:50 +0200 |
commit | da463fb007dafe6c83c3aaf52358fabc9707ded1 (patch) | |
tree | 0297e0fe66e1a152bf153414ba5e77f18d7e42f2 | |
parent | f38b912fcfbb9a6289a161242c7e9ce2eae8cc0d (diff) | |
download | busybox-w32-da463fb007dafe6c83c3aaf52358fabc9707ded1.tar.gz busybox-w32-da463fb007dafe6c83c3aaf52358fabc9707ded1.tar.bz2 busybox-w32-da463fb007dafe6c83c3aaf52358fabc9707ded1.zip |
hush: style cleanups. no code changes
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r-- | shell/hush.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/shell/hush.c b/shell/hush.c index 541962470..54aee882e 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -1792,7 +1792,7 @@ static void cmdedit_update_prompt(void) | |||
1792 | G.PS2 = "> "; | 1792 | G.PS2 = "> "; |
1793 | } | 1793 | } |
1794 | 1794 | ||
1795 | static const char* setup_prompt_string(int promptmode) | 1795 | static const char *setup_prompt_string(int promptmode) |
1796 | { | 1796 | { |
1797 | const char *prompt_str; | 1797 | const char *prompt_str; |
1798 | debug_printf("setup_prompt_string %d ", promptmode); | 1798 | debug_printf("setup_prompt_string %d ", promptmode); |
@@ -2183,7 +2183,7 @@ static int o_save_ptr_helper(o_string *o, int n) | |||
2183 | n, string_len, string_start); | 2183 | n, string_len, string_start); |
2184 | o->has_empty_slot = 0; | 2184 | o->has_empty_slot = 0; |
2185 | } | 2185 | } |
2186 | list[n] = (char*)(ptrdiff_t)string_len; | 2186 | list[n] = (char*)(uintptr_t)string_len; |
2187 | return n + 1; | 2187 | return n + 1; |
2188 | } | 2188 | } |
2189 | 2189 | ||
@@ -2193,7 +2193,7 @@ static int o_get_last_ptr(o_string *o, int n) | |||
2193 | char **list = (char**)o->data; | 2193 | char **list = (char**)o->data; |
2194 | int string_start = ((n + 0xf) & ~0xf) * sizeof(list[0]); | 2194 | int string_start = ((n + 0xf) & ~0xf) * sizeof(list[0]); |
2195 | 2195 | ||
2196 | return ((int)(ptrdiff_t)list[n-1]) + string_start; | 2196 | return ((int)(uintptr_t)list[n-1]) + string_start; |
2197 | } | 2197 | } |
2198 | 2198 | ||
2199 | #ifdef HUSH_BRACE_EXP | 2199 | #ifdef HUSH_BRACE_EXP |
@@ -2231,9 +2231,9 @@ static const char *next_brace_sub(const char *cp) | |||
2231 | cp++; | 2231 | cp++; |
2232 | continue; | 2232 | continue; |
2233 | } | 2233 | } |
2234 | /*{*/ if ((*cp == '}' && depth-- == 0) || (*cp == ',' && depth == 0)) | 2234 | if ((*cp == '}' && depth-- == 0) || (*cp == ',' && depth == 0)) |
2235 | break; | 2235 | break; |
2236 | if (*cp++ == '{') /*}*/ | 2236 | if (*cp++ == '{') |
2237 | depth++; | 2237 | depth++; |
2238 | } | 2238 | } |
2239 | 2239 | ||
@@ -2255,7 +2255,7 @@ static int glob_brace(char *pattern, o_string *o, int n) | |||
2255 | while (1) { | 2255 | while (1) { |
2256 | if (*begin == '\0') | 2256 | if (*begin == '\0') |
2257 | goto simple_glob; | 2257 | goto simple_glob; |
2258 | if (*begin == '{') /*}*/ { | 2258 | if (*begin == '{') { |
2259 | /* Find the first sub-pattern and at the same time | 2259 | /* Find the first sub-pattern and at the same time |
2260 | * find the rest after the closing brace */ | 2260 | * find the rest after the closing brace */ |
2261 | next = next_brace_sub(begin); | 2261 | next = next_brace_sub(begin); |
@@ -2263,7 +2263,7 @@ static int glob_brace(char *pattern, o_string *o, int n) | |||
2263 | /* An illegal expression */ | 2263 | /* An illegal expression */ |
2264 | goto simple_glob; | 2264 | goto simple_glob; |
2265 | } | 2265 | } |
2266 | /*{*/ if (*next == '}') { | 2266 | if (*next == '}') { |
2267 | /* "{abc}" with no commas - illegal | 2267 | /* "{abc}" with no commas - illegal |
2268 | * brace expr, disregard and skip it */ | 2268 | * brace expr, disregard and skip it */ |
2269 | begin = next + 1; | 2269 | begin = next + 1; |
@@ -2280,7 +2280,7 @@ static int glob_brace(char *pattern, o_string *o, int n) | |||
2280 | 2280 | ||
2281 | /* Now find the end of the whole brace expression */ | 2281 | /* Now find the end of the whole brace expression */ |
2282 | rest = next; | 2282 | rest = next; |
2283 | /*{*/ while (*rest != '}') { | 2283 | while (*rest != '}') { |
2284 | rest = next_brace_sub(rest); | 2284 | rest = next_brace_sub(rest); |
2285 | if (rest == NULL) { | 2285 | if (rest == NULL) { |
2286 | /* An illegal expression */ | 2286 | /* An illegal expression */ |
@@ -2316,7 +2316,7 @@ static int glob_brace(char *pattern, o_string *o, int n) | |||
2316 | * That's why we re-copy prefix every time (1st memcpy above). | 2316 | * That's why we re-copy prefix every time (1st memcpy above). |
2317 | */ | 2317 | */ |
2318 | n = glob_brace(new_pattern_buf, o, n); | 2318 | n = glob_brace(new_pattern_buf, o, n); |
2319 | /*{*/ if (*next == '}') { | 2319 | if (*next == '}') { |
2320 | /* We saw the last entry */ | 2320 | /* We saw the last entry */ |
2321 | break; | 2321 | break; |
2322 | } | 2322 | } |
@@ -4990,7 +4990,6 @@ static char **expand_variables(char **argv, unsigned or_mask) | |||
4990 | { | 4990 | { |
4991 | int n; | 4991 | int n; |
4992 | char **list; | 4992 | char **list; |
4993 | char **v; | ||
4994 | o_string output = NULL_O_STRING; | 4993 | o_string output = NULL_O_STRING; |
4995 | 4994 | ||
4996 | /* protect against globbing for "$var"? */ | 4995 | /* protect against globbing for "$var"? */ |
@@ -4999,10 +4998,9 @@ static char **expand_variables(char **argv, unsigned or_mask) | |||
4999 | output.o_glob = 1 & (or_mask / EXPVAR_FLAG_GLOB); | 4998 | output.o_glob = 1 & (or_mask / EXPVAR_FLAG_GLOB); |
5000 | 4999 | ||
5001 | n = 0; | 5000 | n = 0; |
5002 | v = argv; | 5001 | while (*argv) { |
5003 | while (*v) { | 5002 | n = expand_vars_to_list(&output, n, *argv, (unsigned char)or_mask); |
5004 | n = expand_vars_to_list(&output, n, *v, (unsigned char)or_mask); | 5003 | argv++; |
5005 | v++; | ||
5006 | } | 5004 | } |
5007 | debug_print_list("expand_variables", &output, n); | 5005 | debug_print_list("expand_variables", &output, n); |
5008 | 5006 | ||
@@ -5672,7 +5670,7 @@ static char *find_in_path(const char *arg) | |||
5672 | return ret; | 5670 | return ret; |
5673 | } | 5671 | } |
5674 | 5672 | ||
5675 | static const struct built_in_command* find_builtin_helper(const char *name, | 5673 | static const struct built_in_command *find_builtin_helper(const char *name, |
5676 | const struct built_in_command *x, | 5674 | const struct built_in_command *x, |
5677 | const struct built_in_command *end) | 5675 | const struct built_in_command *end) |
5678 | { | 5676 | { |
@@ -5686,11 +5684,11 @@ static const struct built_in_command* find_builtin_helper(const char *name, | |||
5686 | } | 5684 | } |
5687 | return NULL; | 5685 | return NULL; |
5688 | } | 5686 | } |
5689 | static const struct built_in_command* find_builtin1(const char *name) | 5687 | static const struct built_in_command *find_builtin1(const char *name) |
5690 | { | 5688 | { |
5691 | return find_builtin_helper(name, bltins1, &bltins1[ARRAY_SIZE(bltins1)]); | 5689 | return find_builtin_helper(name, bltins1, &bltins1[ARRAY_SIZE(bltins1)]); |
5692 | } | 5690 | } |
5693 | static const struct built_in_command* find_builtin(const char *name) | 5691 | static const struct built_in_command *find_builtin(const char *name) |
5694 | { | 5692 | { |
5695 | const struct built_in_command *x = find_builtin1(name); | 5693 | const struct built_in_command *x = find_builtin1(name); |
5696 | if (x) | 5694 | if (x) |
@@ -6360,7 +6358,7 @@ static int checkjobs(struct pipe* fg_pipe) | |||
6360 | } | 6358 | } |
6361 | 6359 | ||
6362 | #if ENABLE_HUSH_JOB | 6360 | #if ENABLE_HUSH_JOB |
6363 | static int checkjobs_and_fg_shell(struct pipe* fg_pipe) | 6361 | static int checkjobs_and_fg_shell(struct pipe *fg_pipe) |
6364 | { | 6362 | { |
6365 | pid_t p; | 6363 | pid_t p; |
6366 | int rcode = checkjobs(fg_pipe); | 6364 | int rcode = checkjobs(fg_pipe); |