fret 12/10/2004 1:37am
| e.g.
bool IsSubDir(char *Child, char *Parent)
{
#if 1
int PathLen = strlen(Child);
return FsNCompare(Child, Parent, PathLen) == 0;
#else
struct stat c, p;
if (lstat(Child, &c) == 0)
{
char Path[256];
strsafecpy(Path, Parent, sizeof(Path));
while (strlen(Path) > 1)
{
if (lstat(Path, &p) == 0)
{
/*
printf("cmp(%s,%s)=%i,%i - %i\n", Path, Child,
c.st_ino, p.st_ino,
c.st_ino == p.st_ino);
*/
if (c.st_ino == p.st_ino)
{
return true;
}
}
else break;
// Trim off one directory off the path
LgiTrimDir(Path);
}
}
return false;
#endif
} |