aboutsummaryrefslogtreecommitdiffhomepage
path: root/expand.cpp
diff options
context:
space:
mode:
authorGravatar maxfl <gmaxfl@gmail.com>2012-07-08 09:39:39 +0800
committerGravatar maxfl <gmaxfl@gmail.com>2012-07-08 09:39:39 +0800
commite1b8c425da571b7f002103805520a1d496ebb087 (patch)
treef4a9790adc9ba61f3485e0013b6f958f80a14695 /expand.cpp
parent5f05756e657d85026026d95d4ada0b6677861900 (diff)
Fix case when second limit is a variable:
echo $PATH[1..$n]
Diffstat (limited to 'expand.cpp')
-rw-r--r--expand.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/expand.cpp b/expand.cpp
index c370725a..4a3eaf01 100644
--- a/expand.cpp
+++ b/expand.cpp
@@ -735,7 +735,6 @@ static int parse_slice( const wchar_t *in, wchar_t **end_ptr, std::vector<long>
// debug( 0, L"parse_slice on '%ls'", in );
-
while( 1 )
{
long tmp;
@@ -761,6 +760,8 @@ static int parse_slice( const wchar_t *in, wchar_t **end_ptr, std::vector<long>
pos = end-in;
if ( in[pos]==L'.' && in[pos+1]==L'.' ){
pos+=2;
+ while( in[pos]==INTERNAL_SEPARATOR )
+ pos++;
long tmp1 = wcstol( &in[pos], &end, 10 );
if( ( errno ) || ( end == &in[pos] ) )
{