* A path canonicaliser that doesn't depend on the existence of paths

(i.e., it doesn't use realpath(3), which is broken in any case).
  Therefore it doesn't resolve symlinks.
This commit is contained in:
Eelco Dolstra 2003-07-08 19:58:41 +00:00
parent 333f4963de
commit cab3f4977a
2 changed files with 42 additions and 5 deletions

View file

@ -71,6 +71,15 @@ void runTests()
abort();
} catch (BadRefError err) { };
/* Path canonicalisation. */
cout << canonPath("/./../././//") << endl;
cout << canonPath("/foo/bar") << endl;
cout << canonPath("///foo/////bar//") << endl;
cout << canonPath("/././/foo/////bar//.") << endl;
cout << canonPath("/foo////bar//..///x/") << endl;
cout << canonPath("/foo////bar//..//..//x/y/../z/") << endl;
cout << canonPath("/foo/bar/../../../..///") << endl;
/* Dumping. */
#if 0