Amiga Unix — 68040 · 68060

Manual pages › General-purpose library (3G)

basename(3G)

return the last element of a path name

From the original Amiga UNIX 2.1 manual. Some things it mentions may not be in this release.

Also by this name: basename(1), General commands · basename-original(1), General commands · basename(1B), BSD versions of commands

NAME

basename - return the last element of a path name

SYNOPSIS

cc [flag ...] file ...  -lgen [library ...]

#include <libgen.h>

char *basename (char *path);

DESCRIPTION

Given a pointer to a null-terminated character string that contains a path name, basename returns a pointer to the last element of path. Trailing ``/'' characters are deleted. If path or *path is zero, pointer to a static constant ``.'' is returned.

EXAMPLES

Input string   Output pointer
_____________________________
/usr/lib       lib
/usr/          usr
/              /

SEE ALSO

dirname(3G).
basename(1) in the User's Reference Manual.