pike.git / src / combine_path.h

version» Context lines:

pike.git/src/combine_path.h:1: + /* +  * $Id: combine_path.h,v 1.3 2001/06/10 14:53:29 grubba Exp $ +  * +  * Combine path template. +  * +  */ +    #undef IS_SEP   #undef IS_ABS   #undef IS_ROOT   #undef F_COMBINE_PATH   #undef APPEND_PATH      #define COMBINE_PATH_DEBUG 0      #ifdef UNIX_COMBINE_PATH   #define IS_SEP(X) ( (X)=='/' )
pike.git/src/combine_path.h:75: Inside #if defined(IS_ROOT)
   s->s->len=0;    string_builder_append(s, path, tmp);    }    from+=tmp;    }   #endif      #define LAST_PUSHED() (s->s->len ? index_shared_string(s->s,s->s->len-1) : 0)   #define PUSH(X) string_builder_putchar(s,(X))    +  /* Ensure s ends with a separator. */    if(s->s->len && !IS_SEP(LAST_PUSHED()))    PUSH('/');    -  +  /* Remove initial "./" if any. */    if(s->s->len==2)    {    PCHARP to=MKPCHARP_STR(s->s);    if(INDEX_PCHARP(to, 0) == '.')    {    s->s->len=0;    s->known_shift=0;    }    }       while(1)    {   #if COMBINE_PATH_DEBUG > 1    s->s->str[s->s->len]=0; -  fprintf(stderr,"combine_path(2), TO: %s\n",s->s->str); -  fprintf(stderr,"combine_path(2), FROM (%d): %s\n",from,path.ptr+from); +  fprintf(stderr, "combine_path(2), TO: \"%s\"\n", s->s->str); +  fprintf(stderr, "combine_path(2), FROM (%d): \"%s\"\n", +  from, path.ptr+from);   #endif    if(IS_SEP(LAST_PUSHED()))    {    while(s->s->len && IS_SEP(LAST_PUSHED()))    s->s->len--;    PUSH('/');    if(from<len && INDEX_PCHARP(path, from) == '.')    {    int c3;   #if COMBINE_PATH_DEBUG > 0    s->s->str[s->s->len]=0; -  fprintf(stderr,"combine_path(0), TO: %s\n",s->s->str); -  fprintf(stderr,"combine_path(0), FROM (%d): %s\n",from,path.ptr+from); +  fprintf(stderr, "combine_path(0), TO: \"%s\"\n", s->s->str); +  fprintf(stderr, "combine_path(0), FROM (%d): \"%s\"\n", +  from, path.ptr+from);   #endif       switch(INDEX_PCHARP(path, from+1))    {    case '.':    c3=INDEX_PCHARP(path, from+2);    if(IS_SEP(c3) || !c3)    { -  +  /* Handle "..". */    int tmp=s->s->len-1;    -  +  if (tmp) {    while(--tmp>=0) -  if(IS_SEP(index_shared_string(s->s,tmp))) +  if(IS_SEP(index_shared_string(s->s, tmp)))    break;    tmp++; -  +  } else if (IS_SEP(index_shared_string(s->s, 0))) { +  tmp++; +  }       if(index_shared_string(s->s,tmp)=='.' &&    index_shared_string(s->s,tmp+1)=='.' &&    ( IS_SEP(index_shared_string(s->s,tmp+2)) ||    !index_shared_string(s->s,tmp+2)))    break;          from+=2;    s->s->len=tmp;
pike.git/src/combine_path.h:147:   #endif    continue;    }    break;       case 0:    case '/':   #ifdef NT_COMBINE_PATH    case '\\':   #endif +  /* Handle ".". */    from++;    continue;    }    }    }       if(from>=len) break;    PUSH(INDEX_PCHARP(path, from++));    }    if((s->s->len > 1) &&