diff options
| author | Chet Ramey <chet.ramey@case.edu> | 2011-11-21 20:51:19 -0500 |
|---|---|---|
| committer | Chet Ramey <chet.ramey@case.edu> | 2011-11-21 20:51:19 -0500 |
| commit | 0001803f0b9523c94fa2ede48eaecb047fef4524 (patch) | |
| tree | f334332811e033ff966d94f6268f0629a94304b3 /braces.c | |
| parent | 89a92869e56aba4e4cab2d639c00a86f0545c862 (diff) | |
| download | android_external_bash-0001803f0b9523c94fa2ede48eaecb047fef4524.tar.gz android_external_bash-0001803f0b9523c94fa2ede48eaecb047fef4524.tar.bz2 android_external_bash-0001803f0b9523c94fa2ede48eaecb047fef4524.zip | |
Bash-4.1 distribution source
Diffstat (limited to 'braces.c')
| -rw-r--r-- | braces.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -364,7 +364,7 @@ expand_seqterm (text, tlen) char *t, *lhs, *rhs; int i, lhs_t, rhs_t, lhs_v, rhs_v, incr, lhs_l, rhs_l, width; intmax_t tl, tr; - char **result, *ep; + char **result, *ep, *oep; t = strstr (text, BRACE_SEQ_SPECIFIER); if (t == 0) @@ -410,10 +410,12 @@ expand_seqterm (text, tlen) incr = 1; if (rhs_t != ST_BAD) { + oep = ep; if (ep && *ep == '.' && ep[1] == '.' && ep[2]) incr = strtoimax (ep + 2, &ep, 10); if (*ep != 0) rhs_t = ST_BAD; /* invalid incr */ + tlen -= ep - oep; } if (lhs_t != rhs_t || lhs_t == ST_BAD || rhs_t == ST_BAD) @@ -449,6 +451,11 @@ expand_seqterm (text, tlen) width = rhs_l, lhs_t = ST_ZINT; if (rhs_l > 2 && rhs[0] == '-' && rhs[1] == '0' && width < rhs_l) width = rhs_l, lhs_t = ST_ZINT; + + if (width < lhs_l && lhs_t == ST_ZINT) + width = lhs_l; + if (width < rhs_l && lhs_t == ST_ZINT) + width = rhs_l; } result = mkseq (lhs_v, rhs_v, incr, lhs_t, width); |
