This header provides functions ported from Unix in libgen.h. More...

Macros

#define basename(p)   evil_basename(p)
 Wrapper around evil_basename().
 
#define dirname(p)   evil_dirname(p)
 Wrapper around evil_dirname().
 

Functions

char * evil_basename (char *path)
 Parse the base name component of a path.
 
char * evil_dirname (char *path)
 Parse the dir name component of a path.
 

Detailed Description

This header provides functions ported from Unix in libgen.h.

Function Documentation

char* evil_basename ( char *  path)

Parse the base name component of a path.

Parameters
pathThe path to parse.
Returns
The component following the final '/'.

This function parses path and returns its component following the final '\'. Trailing '\' are not taken into account. On Windows XP, path must beginning by a drive letter followed by ':/' or ':\', otherwise "C:\" is returned. All characters '/' are replaced by '\'. On error (memory allocation failure), "C:\" is returned, otherwise the component following the final '\' is returned as a statically allocated memory. Hence the returns value must not be freed.

Concatenating the string returned by dirname(), a "\", and the string returned by basename() yields a complete pathname.

See Also
evil_dirname()
dirname()

Conformity: Non applicable.

Supported OS: Windows XP.

References evil_path_is_absolute().

char* evil_dirname ( char *  path)

Parse the dir name component of a path.

Parameters
pathThe path to parse.
Returns
The component up to, but not including, the final '/'.

This function parses path and returns its component up to, but not including, the final '/'. Trailing '\' are not taken into account. On Windows XP, path must beginning by a drive letter followed by ':/' or ':\', otherwise "C:\" is returned. All characters '/' are replaced by '\'. On error (memory allocation failure), "C:\" is returned, otherwise, the component up to, but not including, the final '/' is returned as a statically allocated memory. Hence the returns value must not be freed.

Concatenating the string returned by dirname(), a "\", and the string returned by basename() yields a complete pathname.

See Also
evil_basename()
basename()

Conformity: Non applicable.

Supported OS: Windows XP.

References evil_path_is_absolute().