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
SHTK_FS_NORMALIZE_PATH(3) FreeBSD Library Functions Manual SHTK_FS_NORMALIZE_PATH(3)

shtk_fs_normalize_pathReturns a normalized form of a path

shtk_import fs

shtk_fs_normalize_path path

The shtk_fs_normalize_path function takes the given path and prints its normalized form to stdout.

This process involves the following:

  • Collapsing multiple consecutive forward slashes into one.
  • Adding a . component at the beginning of the path if it is relative.
  • Removing any . components, except for the first one.
  • Removing any trailing slashes.

Note that the normalization happens performing any file system operations. Therefore, it is perfectly possible for two normalized paths that look different to point to the same file system entry. In particular, this is because normalization does not take into account links nor .. components.

shtk_fs_normalize_path returns 0.

shtk_fs_normalize_path /foo/bar  # Prints /foo/bar
shtk_fs_normalize_path foo/bar  # Prints ./foo/bar
shtk_fs_normalize_path foo///bar/./baz//  # Prints ./foo/bar/baz

shtk(3), shtk_fs(3)

shtk_fs_normalize_path first appeared in shtk 1.7.

September 18, 2016 FreeBSD 14.3-RELEASE

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.