*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> basename (3)              
Title
Content
Arch
Section
 

BASENAME(3)

Contents


NAME    [Toc]    [Back]

     basename -- extract the base portion of a pathname

SYNOPSIS    [Toc]    [Back]

     #include <libgen.h>

     char *
     basename(const char *path);

DESCRIPTION    [Toc]    [Back]

     The basename() function returns the last component from the pathname
     pointed to by path, deleting any trailing `/' characters.	If path consists
 entirely of `/' characters, a pointer to the string "/" is
     returned.	If path is a null pointer or the empty string, a pointer to
     the string "." is returned.

RETURN VALUES    [Toc]    [Back]

     On successful completion, basename() returns a pointer to the last component
 of path.

     If basename() fails, a null pointer is returned and the global variable
     errno is set to indicate the error.

ERRORS    [Toc]    [Back]

     The following error codes may be set in errno:

     [ENAMETOOLONG]	The path component to be returned was larger than
			MAXPATHLEN.

WARNINGS    [Toc]    [Back]

     The basename() function returns a pointer to internal static storage
     space that will be overwritten by subsequent calls.

SEE ALSO    [Toc]    [Back]

      
      
     basename(1), dirname(1), dirname(3)

STANDARDS    [Toc]    [Back]

     The basename() function conforms to X/Open Portability Guide Issue 4.2
     (``XPG4.2'').

HISTORY    [Toc]    [Back]

     The basename() function first appeared in OpenBSD 2.2 and FreeBSD 4.2.

AUTHORS    [Toc]    [Back]

     Todd C. Miller <[email protected]>


FreeBSD 5.2.1			August 17, 1997 		 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
dirname OpenBSD extract the directory portion of a pathname
dirname Tru64 Return the base filename or directory portion of a pathname
dirname_r Tru64 Return the base filename or directory portion of a pathname
basename Tru64 Return the base filename or directory portion of a pathname
basename OpenBSD return filename portion of pathname
dirname OpenBSD return directory portion of pathname
dirname FreeBSD return filename or directory portion of pathname
basename FreeBSD return filename or directory portion of pathname
dirname Tru64 Returns the base file name or directory portion of a path name
basename Tru64 Returns the base file name or directory portion of a path name
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service