mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-21 23:29:16 +00:00
67 lines
1.3 KiB
Groff
67 lines
1.3 KiB
Groff
.\"
|
|
.\" Routines and man page by Devin Reade
|
|
.\"
|
|
.\" $Id: basename.3,v 1.1 1997/02/27 07:32:21 gdr Exp $
|
|
.\"
|
|
.TH BASENAME 3 "26 November 1995" GNO "Library Routines"
|
|
.SH NAME
|
|
.BR basename ,
|
|
.BR dirname
|
|
\- get components of a pathname
|
|
.SH SYNOPSIS
|
|
#include <unistd.h>
|
|
.sp 1
|
|
char *\fBbasename\fR (const char *\fIpath\fR);
|
|
.br
|
|
char *\fBdirname\fR (const char *\fIpath\fR);
|
|
.SH DESCRIPTION
|
|
.B basename
|
|
returns a pointer to the file component of
|
|
.IR path .
|
|
If
|
|
.I path
|
|
ends with a directory separator, then
|
|
.B basename
|
|
returns an empty string.
|
|
.LP
|
|
.B dirname
|
|
returns a pointer to an internal buffer containing the directory
|
|
component of
|
|
.IR path ,
|
|
without a trailing directory separator.
|
|
If
|
|
.I path
|
|
ends with a directory separator, then that character is the only part
|
|
of
|
|
.I path
|
|
not included in the resultant string.
|
|
If
|
|
.I path
|
|
is NULL, an empty string is returned.
|
|
.LP
|
|
Unlike
|
|
.BR ExpandPathGS (2),
|
|
.BR dirname
|
|
does not expand any GS/OS prefixes that may be present in
|
|
.IR path .
|
|
.LP
|
|
Under GS/OS, permissable directory separators are
|
|
.B :
|
|
and
|
|
.BR / ,
|
|
with the former taking precedence.
|
|
.SH COMPATIBILITY
|
|
.BR basename
|
|
is thread-safe;
|
|
.BR dirname
|
|
is not.
|
|
.SH BUGS
|
|
If
|
|
.IR path
|
|
is longer than PATH_MAX characters,
|
|
.BR dirname
|
|
will only consider the first PATH_MAX-1 characters.
|
|
.SH AUTHOR
|
|
Devin Reade <gdr@myrias.com>
|
|
|