version 1.12, 2003/04/10 23:21:57 |
version 1.13, 2003/04/14 03:14:06 |
|
|
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 |
|
|
} |
} |
|
|
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); |
|
|
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) { |