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
path(3m) MBA Library Functions path(3m)

path - manipulate file path names

#include <mba/path.h>

int path_canon(const unsigned char *src,
            const unsigned char *slim,
            unsigned char *dst,
            unsigned char *dlim,
            int srcsep,
            int dstsep);

The path(3m) module provides functions for some common path manipulations.
canon
The path_canon function canonicalizes the path at src up to but not including the memory at slim into the memory at dst up to but not including dlim. The character that separates path components in the src path is specified with the srcsep parameter whereas dstsep specifies the separator with which the dst path is constructed.

Specifically, canonicalization will eliminate '.' and '..' components in paths in the conventional way as well as normalize redundant separators. The presence or lack of an initial and/or trailing separator is preserved. The following lists some examples of paths before and after canonicalization:

before      after
/           /
/.          /
a/..        
abc/../
a/b/c       a/b/c
/a/b/c      /a/b/c 
/./a/b/c    /a/b/c
/../a/b/c   /a/b/c
a/b/c/      a/b/c/
a/b/c/..    a/b/
a/b/c/../   a/b/
a/b/c/./    a/b/c/

canon
The path_canon function returns the number of bytes written to dst not including the zero terminator or -1 if slim or dlim has been reached in which case errno is set to ERANGE.
April 29, 2005 libmba-0.9.1

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.