2 * Copyright 1999 by The XFree86 Project, Inc.
4 /* $XFree86: xc/config/util/revpath.c,v 1.2 1999/02/01 11:55:49 dawes Exp $ */
7 * Reverse a pathname. It returns a relative path that can be used to undo
10 * It is impossible to do this in general, but this handles the cases that
11 * come up in imake. Maybe imake should use an absolute path for $(TOP)
12 * instead of a relative path so that this problem can be avoided?
20 main(int argc, char *argv[])
25 /* Silently ignore invalid usage */
29 /* Split the path and count the levels */
30 p = strtok(argv[1], "/");
32 if (strcmp(p, ".") == 0)
34 else if (strcmp(p, "..") == 0)
38 p = strtok(NULL, "/");