Loading...
--- Libc/Libc-262/gen/basename.3
+++ Libc/Libc-498/gen/basename.3
@@ -25,7 +25,7 @@
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $OpenBSD: basename.3,v 1.12 2000/04/18 03:01:25 aaron Exp $
-.\" $FreeBSD: src/lib/libc/gen/basename.3,v 1.4 2001/10/01 16:08:50 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/basename.3,v 1.7 2004/07/02 23:52:10 ru Exp $
.\"
.Dd August 17, 1997
.Dt BASENAME 3
@@ -36,25 +36,27 @@
.Sh SYNOPSIS
.In libgen.h
.Ft char *
-.Fn basename "const char *path"
+.Fo basename
+.Fa "char *path"
+.Fc
.Sh DESCRIPTION
The
.Fn basename
function
returns the last component from the pathname pointed to by
-.Ar path ,
+.Fa path ,
deleting any trailing
.Sq \&/
characters.
If
-.Ar path
+.Fa path
consists entirely of
.Sq \&/
characters, a pointer to the string
.Qq \&/
is returned.
If
-.Ar path
+.Fa path
is a null pointer or the empty string, a pointer to the string
.Qq \&.
is returned.
@@ -62,7 +64,7 @@
On successful completion,
.Fn basename
returns a pointer to the last component of
-.Ar path .
+.Fa path .
.Pp
If
.Fn basename
@@ -78,13 +80,30 @@
.Dv MAXPATHLEN .
.El
.Sh WARNINGS
+The
.Fn basename
-returns a pointer to internal static storage space that will be overwritten
-by subsequent calls.
+function
+returns a pointer to internal static storage space
+that will be overwritten by subsequent calls.
+The function may modify the string pointed to by
+.Fa path .
+.Sh LEGACY SYNOPSIS
+.Fd #include <libgen.h>
+.Pp
+.Ft char *
+.br
+.Fo basename
+.Fa "const char *path"
+.Fc ;
+.Pp
+In legacy mode,
+.Fa path
+will not be changed.
.Sh SEE ALSO
.Xr basename 1 ,
.Xr dirname 1 ,
-.Xr dirname 3
+.Xr dirname 3 ,
+.Xr compat 5
.Sh STANDARDS
The
.Fn basename
@@ -98,4 +117,4 @@
and
.Fx 4.2 .
.Sh AUTHORS
-Todd C. Miller <Todd.Miller@courtesan.com>
+.An "Todd C. Miller" Aq Todd.Miller@courtesan.com