nut/include/libgen.h File Reference


Detailed Description

Path name parts.

 *
 * $Log: libgen.h,v $
 * Revision 1.1  2006/08/01 07:42:56  haraldkipp
 * New functions extract last component and parent directory from pathnames.
 *
 *
 * 

#include <sys/types.h>

Functions

__BEGIN_DECLS char * basename (CONST char *)
 Return the last component from a given pathname.
char * dirname (CONST char *)
 Extract the directory part of a given pathname.


Function Documentation

__BEGIN_DECLS char* basename ( CONST char *  path  ) 

Return the last component from a given pathname.

Trailing slashes are removed.

Note:
This function returns a pointer to internal static storage space that will be overwritten by subsequent calls.
Parameters:
path Pointer to the pathname.
Returns:
Pointer to the last component. If the specified pathname contains slashes only, a single slash is returned. If the pathname is empty or a NULL pointer, then a single dot is returned. In case of any error, a NULL pointer is returned and the global variable errno is set to indicate the error.

char* dirname ( CONST char *  path  ) 

Extract the directory part of a given pathname.

This is the converse of basename().

Parameters:
path Pointer to the pathname.
Returns:
A pointer to the parent directory of the pathname. Any trailing slash is not counted as part of the directory name. If the specified pathname is a null pointer, an empty string, or contains no slash character, then a single dot is returned. On failures, a NULL pointer is returned and the global variable errno is set to indicate the error.


Generated on Tue Jan 23 21:12:26 2007 for BTnut System Software by doxygen 1.4.7