nut/fs/dirname.c File Reference


Detailed Description

Extracts the directory part of a pathname.

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

#include <errno.h>
#include <libgen.h>
#include <stdlib.h>
#include <string.h>

Defines

#define MAXPATHLEN   256

Functions

char * dirname (CONST char *path)
 Extract the directory part of a given pathname.


Function Documentation

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:25 2007 for BTnut System Software by doxygen 1.4.7