[BACK]Return to misc.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/misc.c between version 1.27 and 1.28

version 1.27, 2004/12/11 01:48:56 version 1.28, 2005/03/01 10:09:52
Line 269 
Line 269 
         return total;          return total;
 }  }
   
   /*
    * Search for next delimiter between hostnames/addresses and ports.
    * Argument may be modified (for termination).
    * Returns *cp if parsing succeeds.
    * *cp is set to the start of the next delimiter, if one was found.
    * If this is the last field, *cp is set to NULL.
    */
   char *
   hpdelim(char **cp)
   {
           char *s, *old;
   
           if (cp == NULL || *cp == NULL)
                   return NULL;
   
           old = s = *cp;
           if (*s == '[') {
                   if ((s = strchr(s, ']')) == NULL)
                           return NULL;
                   else
                           s++;
           } else if ((s = strpbrk(s, ":/")) == NULL)
                   s = *cp + strlen(*cp); /* skip to end (see first case below) */
   
           switch (*s) {
           case '\0':
                   *cp = NULL;     /* no more fields*/
                   break;
   
           case ':':
           case '/':
                   *s = '\0';      /* terminate */
                   *cp = s + 1;
                   break;
   
           default:
                   return NULL;
           }
   
           return old;
   }
   
 char *  char *
 cleanhostname(char *host)  cleanhostname(char *host)
 {  {

Legend:
Removed from v.1.27  
changed lines
  Added in v.1.28