Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

basename.c File Reference


Detailed Description

Returns last component of a pathname.

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


Defines

#define MAXPATHLEN   256

Functions

char * basename (CONST char *path)
 Return the last component from a given pathname.


Function Documentation

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.


© 2000-2006 by egnite Software GmbH - visit http://www.ethernut.de/