2004-01-12
2004-01-12 22:56:48 by Marcus Comstedt <marcus@mc.pp.se>
-
57834da1b3f6bb918425b7a21c8a585a15f4f5fd
(33 lines)
(+19/-14)
[
Show
| Annotate
]
Branch: 7.9
Fixed some ..-related bugs.
Rev: src/combine_path.h:1.14
2:
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
- || $Id: combine_path.h,v 1.13 2003/12/18 21:22:24 marcus Exp $
+ || $Id: combine_path.h,v 1.14 2004/01/12 22:56:48 marcus Exp $
*/
/*
46:
{
int l;
for(l=2;INDEX_PCHARP(s,l) && !IS_SEP(INDEX_PCHARP(s,l));l++);
- return l;
+ return INDEX_PCHARP(s,l)? l+1:l;
}
return 0;
108:
s->known_shift=0;
string_builder_append(s, path, tmp);
from+=tmp;
- abs++;
+ abs=tmp;
}
#ifdef IS_ROOT
else if((tmp=IS_ROOT(path)))
{
int tmp2;
- abs++;
+
s->known_shift=0;
if((tmp2=IS_ABS(MKPCHARP_STR(s->s))))
{
s->s->len=tmp2;
-
+ abs=tmp2;
}else{
s->s->len=0;
string_builder_append(s, path, tmp);
-
+ abs=tmp;
}
from+=tmp;
}
193:
{
/* Handle "..". */
int tmp=s->s->len-1;
-
+
if (tmp) {
while(--tmp>=0)
if(IS_SEP(index_shared_string(s->s, tmp)))
203:
tmp++;
}
+ if (tmp < abs)
+ tmp = abs;
+ else
if ((tmp+1 < s->s->len) &&
(index_shared_string(s->s,tmp)=='.') &&
(index_shared_string(s->s,tmp+1)=='.') &&
210:
IS_SEP(index_shared_string(s->s,tmp+2))))
break;
-
- from+=2;
+ from+=(c3? 3:2);
s->s->len=tmp;
s->known_shift=0;
240:
if(from>=len) break;
PUSH(INDEX_PCHARP(path, from++));
}
- if((s->s->len > 1) &&
+ if((s->s->len > 1) && (s->s->len > abs) &&
!IS_SEP(INDEX_PCHARP(path, from-1)) &&
IS_SEP(LAST_PUSHED()))
s->s->len--;
253: Inside #if defined(CHAR_CURRENT)
#ifdef CHAR_CURRENT
}else{
PUSH(CHAR_CURRENT);
+ if(IS_SEP(INDEX_PCHARP(path, from-1)))
+ PUSH('/');
#endif
}
}