Branch: Tag:

2001-06-10

2001-06-10 14:53:29 by Henrik Grubbström (Grubba) <grubba@grubba.org>

More bugfixes...

Rev: src/combine_path.h:1.3

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
82:   #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);
99: Inside #if COMBINE_PATH_DEBUG > 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()))    {
112: Inside #if COMBINE_PATH_DEBUG > 0
   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))
122:    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)=='.' &&
154: Inside #if defined(NT_COMBINE_PATH)
  #ifdef NT_COMBINE_PATH    case '\\':   #endif +  /* Handle ".". */    from++;    continue;    }