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

Diff for /src/usr.bin/rdist/common.c between version 1.18 and 1.19

version 1.18, 2003/04/19 17:22:29 version 1.19, 2003/05/06 21:52:25
Line 985 
Line 985 
 extern char *searchpath(path)  extern char *searchpath(path)
         char *path;          char *path;
 {  {
         char *cp;  
         char *file;          char *file;
           char *space;
           int found;
         struct stat statbuf;          struct stat statbuf;
   
         for (; ;) {          for (found = 0; !found && (file = strsep(&path, ":")) != NULL; ) {
                 if (!path)                  if ((space = strchr(file, ' ')) != NULL)
                         return(NULL);                          *space = CNULL;
                 file = path;                  found = stat(file, &statbuf) == 0;
                 cp = strchr(path, ':');                  if (space)
                 if (cp) {                          *space = ' ';           /* Put back what we zapped */
                         path = cp + 1;  
                         *cp = CNULL;  
                 } else  
                         path = NULL;  
                 if (stat(file, &statbuf) == 0)  
                         return(file);  
                 /* Put back what we zapped */  
                 if (path)  
                         *cp = ':';  
         }          }
           return (file);
 }  }
   
 /*  /*

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19