Pathrewrite
Appearance
Using the Innotek Libc pathrewrite function
When porting application from unix flavours you might run into the problem that some parts are hardcoded into the application, most famous is ofcourse /etc.
Libc provides a interface to work around these problems without completely rewriting the application, and thus easying the maintenance for the porter.
In this article I'll try to outline the posibilities from what I used myself and will give a example.
First lets see what is documented inside the libc pathrewrite.c file:
/** @page PathRewrite Path Rewrite Feature * * The Path Rewrite Feature was designed as a replacement for the hardcoded * mapping of /dev/null to nul and /dev/tty to con in __open.c. It allows * the user of LIBC to automatically rewrite (map) paths given to LIBC APIS. * The user can dynamically add and remove rewrite rules. The environment * variable LIBC_PATHREWRITERS can be used to dynamically load DLLs containing * rewrite rules and add it to the process. * * * @subsection LIBC_PATHREWRITERS * * The format is <dllname>@<export>. LIBC will load <dllname>, resolve <export> * and call <export> with pointers to the three __libc_PathRewrite interfaces. * The <export> function will then register and remove rules as it pleases it. * Single of double quotes can be applied to the <dllname>. Multiple rewriters * must be separated by space. * * Examples: * set LIBC_PATHREWRITERS=prwhome.dll@_instprws * set LIBC_PATHREWRITERS=/usr/lib/prwhome.dll@_instprws * set LIBC_PATHREWRITERS="c:\My Plugins\prwhome.dll"@_instprws * set LIBC_PATHREWRITERS=prwhome@_insthomeprws prwhome@_instetcprws */