Lines Matching refs:pathname
67 /* A normal Unix pathname contains no duplicate slashes and does not end
70 /* Normalize the given pathname, whose length is len, starting at the given
72 static char* normalizePath(const char* pathname, int len, int off) {
77 if (len == 0) return (char*)pathname;
79 while ((n > 0) && (pathname[n - 1] == slash)) n--;
82 sb = (char*)malloc(strlen(pathname)+1);
86 memcpy(sb, pathname, off);
92 char c = pathname[i];
100 /* Check that the given pathname is normal. If not, invoke the real
101 normalizer on the part of the pathname that requires normalization.
102 This way we iterate through the whole pathname string only once. */
103 char* normalize(const char* pathname) {
105 int n = strlen(pathname);
108 char c = pathname[i];
110 return normalizePath(pathname, n, i - 1);
113 if (prevChar == slash) return normalizePath(pathname, n, n - 1);
114 return (char*)pathname;