Branch: Tag:

2004-05-01

2004-05-01 15:04:35 by Martin Stjernholm <mast@lysator.liu.se>

Backported combine_path fix from 7.7.

Rev: src/combine_path.h:1.12

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.11 2002/10/11 01:39:30 nilsson Exp $ + || $Id: combine_path.h,v 1.12 2004/05/01 15:04:35 mast Exp $   */      /*
41:    {    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;
72:    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;    }
142:    {    /* Handle "..". */    int tmp=s->s->len-1; -  +     if (tmp) {    while(--tmp>=0)    if(IS_SEP(index_shared_string(s->s, tmp)))
152:    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)=='.') &&
159:    IS_SEP(index_shared_string(s->s,tmp+2))))    break;    -  -  from+=2; +  from+=(c3? 3:2);    s->s->len=tmp;    s->known_shift=0;   
188:    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--;
200:    PUSH('/');    }else{    PUSH('.'); +  if(IS_SEP(INDEX_PCHARP(path, from-1))) +  PUSH('/');    }    }   }