GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
GET9ROOT(3) FreeBSD Library Functions Manual GET9ROOT(3)

get9root, unsharp - get path to root of Plan 9 tree

#include <u.h>
#include <libc.h>

char* get9root(void)

char* unsharp(char *path)

This tree of Plan 9 software is conventionally installed in but may be installed in other places (for example, users without the ability to write to /usr/local may with to install it in their own home directories). The environment variable $PLAN9 should contain the path to the root. Get9root returns a static pointer to the pathname of root, first checking $PLAN9 and defaulting to .

The lack of a fixed location for the Plan 9 tree makes it difficult to hard-code paths to files. Unsharp replaces a leading #9 in path with the root of the tree. Unsharp also replaces a leading #d with the path to the underlying system's file descriptor dup device, typically /dev/fd. The string returned from unsharp, if different from path, should be freed with free (see when no longer needed.

As a convention, programs should never unsharp paths obtained from user input.

The uses this code to find unrooted file names included by plumb rules.
snprint(buf, sizeof buf, "#9/plumb/%s", name);
fd = open(unsharp(buf), OREAD);
    

/src/lib9/get9root.c
/src/lib9/unsharp.c

Get9root could be smarter about finding the tree when $PLAN9 is not set.

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.