3 get9root, unsharp \- get path to root of Plan 9 tree
13 char* unsharp(char *path)
15 This tree of Plan 9 software is conventionally installed in
17 but may be installed in other places (for example, users without
18 the ability to write to
20 may with to install it in their own home directories).
21 The environment variable
23 should contain the path to the root.
25 returns a static pointer to the pathname of root, first checking
30 The lack of a fixed location for the Plan 9 tree
31 makes it difficult to hard-code paths
38 with the root of the tree.
40 also replaces a leading
42 with the path to the underlying system's file descriptor dup device,
45 The string returned from
53 when no longer needed.
55 As a convention, programs should never
57 paths obtained from user input.
61 uses this code to find unrooted file names included by plumb rules.
64 snprint(buf, sizeof buf, "#9/plumb/%s", name);
65 fd = open(unsharp(buf), OREAD);
68 .B \*9/src/lib9/get9root.c
70 .B \*9/src/lib9/unsharp.c
75 could be smarter about finding the tree when