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

Diff for /src/usr.bin/lndir/lndir.c between version 1.12 and 1.13

version 1.12, 2003/04/10 23:21:57 version 1.13, 2003/04/14 03:14:06
Line 134 
Line 134 
 int  int
 equivalent(char *lname, char *rname)  equivalent(char *lname, char *rname)
 {  {
         char *s;          char *s, *ns;
   
         if (strcmp(lname, rname) == 0)          if (strcmp(lname, rname) == 0)
                 return(1);                  return(1);
         for (s = lname; *s && (s = strchr(s, '/')); s++) {          for (s = lname; *s && (s = strchr(s, '/')); s++) {
                 while (s[1] == '/')                  if (s[1] == '/') {
                         strcpy(s+1, s+2);                          /* collapse multiple slashes in lname */
                           for (ns = s + 1; *ns == '/'; ns++)
                                   ;
                           memmove(s + 1, ns, strlen(ns) + 1);
                   }
         }          }
         return(!strcmp(lname, rname));          return(strcmp(lname, rname) == 0);
 }  }
   
 void  void
Line 189 
Line 193 
         }          }
   
         if (rel)          if (rel)
                 strlcpy(buf, "../", sizeof buf);                  strlcpy(buf, "../", sizeof(buf));
         else          else
                 buf[0] = '\0';                  buf[0] = '\0';
         strlcat(buf, fn, sizeof buf);          strlcat(buf, fn, sizeof(buf));
   
         if (!(df = opendir(buf))) {          if (!(df = opendir(buf))) {
                 warn("%s: Cannot opendir", buf);                  warn("%s: Cannot opendir", buf);
Line 210 
Line 214 
                         if (!strcmp (dp->d_name, cur->name))                          if (!strcmp (dp->d_name, cur->name))
                                 goto next;      /* can't continue */                                  goto next;      /* can't continue */
                 }                  }
                 strcpy(p, dp->d_name);                  strlcpy(p, dp->d_name, buf + sizeof(buf) - p);
   
                 if (n_dirs > 0) {                  if (n_dirs > 0) {
                         if (stat(buf, &sb) < 0) {                          if (stat(buf, &sb) < 0) {

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13