2 * Copyright 1999 by The XFree86 Project, Inc.
6 * Reverse a pathname. It returns a relative path that can be used to undo
9 * It is impossible to do this in general, but this handles the cases that
10 * come up in imake. Maybe imake should use an absolute path for $(TOP)
11 * instead of a relative path so that this problem can be avoided?
19 main(int argc, char *argv[])
24 /* Silently ignore invalid usage */
28 /* Split the path and count the levels */
29 p = strtok(argv[1], "/");
31 if (strcmp(p, ".") == 0)
33 else if (strcmp(p, "..") == 0)
37 p = strtok(NULL, "/");