diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-25 05:51:41 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-25 05:51:41 +0000 |
commit | f7d56659693c78c26b25037c7f74101a4aede381 (patch) | |
tree | 3f7c11d5a9f61749bb64e0d71d500bab03f3fd39 /shell/ash.c | |
parent | 68e5e2b1c730e6fc07cf9467fd64c1d284c6afe4 (diff) | |
download | busybox-w32-f7d56659693c78c26b25037c7f74101a4aede381.tar.gz busybox-w32-f7d56659693c78c26b25037c7f74101a4aede381.tar.bz2 busybox-w32-f7d56659693c78c26b25037c7f74101a4aede381.zip |
ash: comment about [[; code style fixes. No code changes.
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/shell/ash.c b/shell/ash.c index 62380b3ab..9024d783d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -2230,7 +2230,8 @@ padvance(const char **path, const char *name) | |||
2230 | if (*path == NULL) | 2230 | if (*path == NULL) |
2231 | return NULL; | 2231 | return NULL; |
2232 | start = *path; | 2232 | start = *path; |
2233 | for (p = start; *p && *p != ':' && *p != '%'; p++); | 2233 | for (p = start; *p && *p != ':' && *p != '%'; p++) |
2234 | continue; | ||
2234 | len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */ | 2235 | len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */ |
2235 | while (stackblocksize() < len) | 2236 | while (stackblocksize() < len) |
2236 | growstackblock(); | 2237 | growstackblock(); |
@@ -2244,7 +2245,8 @@ padvance(const char **path, const char *name) | |||
2244 | pathopt = NULL; | 2245 | pathopt = NULL; |
2245 | if (*p == '%') { | 2246 | if (*p == '%') { |
2246 | pathopt = ++p; | 2247 | pathopt = ++p; |
2247 | while (*p && *p != ':') p++; | 2248 | while (*p && *p != ':') |
2249 | p++; | ||
2248 | } | 2250 | } |
2249 | if (*p == ':') | 2251 | if (*p == ':') |
2250 | *path = p + 1; | 2252 | *path = p + 1; |
@@ -8427,7 +8429,7 @@ static int exportcmd(int, char **); | |||
8427 | static int getoptscmd(int, char **); | 8429 | static int getoptscmd(int, char **); |
8428 | #endif | 8430 | #endif |
8429 | #if !ENABLE_FEATURE_SH_EXTRA_QUIET | 8431 | #if !ENABLE_FEATURE_SH_EXTRA_QUIET |
8430 | static int helpcmd(int argc, char **argv); | 8432 | static int helpcmd(int, char **); |
8431 | #endif | 8433 | #endif |
8432 | #if ENABLE_ASH_MATH_SUPPORT | 8434 | #if ENABLE_ASH_MATH_SUPPORT |
8433 | static int letcmd(int, char **); | 8435 | static int letcmd(int, char **); |
@@ -8450,7 +8452,19 @@ static int ulimitcmd(int, char **); | |||
8450 | #define BUILTIN_REG_ASSG "6" | 8452 | #define BUILTIN_REG_ASSG "6" |
8451 | #define BUILTIN_SPEC_REG_ASSG "7" | 8453 | #define BUILTIN_SPEC_REG_ASSG "7" |
8452 | 8454 | ||
8453 | /* make sure to keep these in proper order since it is searched via bsearch() */ | 8455 | /* We do not handle [[ expr ]] bashism bash-compatibly, |
8456 | * we make it a synonym of [ expr ]. | ||
8457 | * Basically, word splitting and pathname expansion should NOT be performed | ||
8458 | * Examples: | ||
8459 | * no word splitting: a="a b"; [[ $a = "a b" ]]; echo $? should print "0" | ||
8460 | * no pathname expansion: [[ /bin/m* = "/bin/m*" ]]; echo $? should print "0" | ||
8461 | * Additional operators: | ||
8462 | * || and && should work as -o and -a | ||
8463 | * =~ regexp match | ||
8464 | * Apart from the above, [[ expr ]] should work as [ expr ] | ||
8465 | */ | ||
8466 | |||
8467 | /* Keep these in proper order since it is searched via bsearch() */ | ||
8454 | static const struct builtincmd builtintab[] = { | 8468 | static const struct builtincmd builtintab[] = { |
8455 | { BUILTIN_SPEC_REG ".", dotcmd }, | 8469 | { BUILTIN_SPEC_REG ".", dotcmd }, |
8456 | { BUILTIN_SPEC_REG ":", truecmd }, | 8470 | { BUILTIN_SPEC_REG ":", truecmd }, |
@@ -9339,7 +9353,8 @@ chkmail(void) | |||
9339 | break; | 9353 | break; |
9340 | if (*p == '\0') | 9354 | if (*p == '\0') |
9341 | continue; | 9355 | continue; |
9342 | for (q = p; *q; q++); | 9356 | for (q = p; *q; q++) |
9357 | continue; | ||
9343 | #if DEBUG | 9358 | #if DEBUG |
9344 | if (q[-1] != '/') | 9359 | if (q[-1] != '/') |
9345 | abort(); | 9360 | abort(); |
@@ -9382,7 +9397,8 @@ setparam(char **argv) | |||
9382 | char **ap; | 9397 | char **ap; |
9383 | int nparam; | 9398 | int nparam; |
9384 | 9399 | ||
9385 | for (nparam = 0; argv[nparam]; nparam++); | 9400 | for (nparam = 0; argv[nparam]; nparam++) |
9401 | continue; | ||
9386 | ap = newparam = ckmalloc((nparam + 1) * sizeof(*ap)); | 9402 | ap = newparam = ckmalloc((nparam + 1) * sizeof(*ap)); |
9387 | while (*argv) { | 9403 | while (*argv) { |
9388 | *ap++ = ckstrdup(*argv++); | 9404 | *ap++ = ckstrdup(*argv++); |
@@ -9531,7 +9547,8 @@ shiftcmd(int argc ATTRIBUTE_UNUSED, char **argv) | |||
9531 | free(*ap1); | 9547 | free(*ap1); |
9532 | } | 9548 | } |
9533 | ap2 = shellparam.p; | 9549 | ap2 = shellparam.p; |
9534 | while ((*ap2++ = *ap1++) != NULL); | 9550 | while ((*ap2++ = *ap1++) != NULL) |
9551 | continue; | ||
9535 | #if ENABLE_ASH_GETOPTS | 9552 | #if ENABLE_ASH_GETOPTS |
9536 | shellparam.optind = 1; | 9553 | shellparam.optind = 1; |
9537 | shellparam.optoff = -1; | 9554 | shellparam.optoff = -1; |
@@ -10563,7 +10580,8 @@ checkend: { | |||
10563 | char *p, *q; | 10580 | char *p, *q; |
10564 | 10581 | ||
10565 | p = line; | 10582 | p = line; |
10566 | for (q = eofmark + 1; *q && *p == *q; p++, q++); | 10583 | for (q = eofmark + 1; *q && *p == *q; p++, q++) |
10584 | continue; | ||
10567 | if (*p == '\n' && *q == '\0') { | 10585 | if (*p == '\n' && *q == '\0') { |
10568 | c = PEOF; | 10586 | c = PEOF; |
10569 | plinno++; | 10587 | plinno++; |
@@ -11004,7 +11022,8 @@ xxreadtoken(void) | |||
11004 | #endif | 11022 | #endif |
11005 | ) { | 11023 | ) { |
11006 | if (c == '#') { | 11024 | if (c == '#') { |
11007 | while ((c = pgetc()) != '\n' && c != PEOF); | 11025 | while ((c = pgetc()) != '\n' && c != PEOF) |
11026 | continue; | ||
11008 | pungetc(); | 11027 | pungetc(); |
11009 | } else if (c == '\\') { | 11028 | } else if (c == '\\') { |
11010 | if (pgetc() != '\n') { | 11029 | if (pgetc() != '\n') { |
@@ -11067,7 +11086,8 @@ xxreadtoken(void) | |||
11067 | #endif | 11086 | #endif |
11068 | continue; | 11087 | continue; |
11069 | case '#': | 11088 | case '#': |
11070 | while ((c = pgetc()) != '\n' && c != PEOF); | 11089 | while ((c = pgetc()) != '\n' && c != PEOF) |
11090 | continue; | ||
11071 | pungetc(); | 11091 | pungetc(); |
11072 | continue; | 11092 | continue; |
11073 | case '\\': | 11093 | case '\\': |