.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $OpenBSD: dirname.3,v 1.9 2000/04/18 03:01:25 aaron Exp $
-.\" $FreeBSD: src/lib/libc/gen/dirname.3,v 1.4 2001/10/01 16:08:50 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/dirname.3,v 1.8 2004/07/02 23:52:10 ru Exp $
.\"
.Dd August 17, 1997
.Dt DIRNAME 3
.Os
.Sh NAME
.Nm dirname
-.Nd extract the directory portition of a pathname
+.Nd extract the directory part of a pathname
.Sh SYNOPSIS
.In libgen.h
.Ft char *
-.Fn dirname "const char *path"
+.Fo dirname
+.Fa "char *path"
+.Fc
.Sh DESCRIPTION
The
.Fn dirname
is the converse of
.Xr basename 3 ;
it returns a pointer to the parent directory of the pathname pointed to by
-.Ar path .
+.Fa path .
Any trailing
.Sq \&/
characters are not counted as part of the directory
name.
If
-.Ar path
+.Fa path
is a null pointer, the empty string, or contains no
.Sq \&/
characters,
On successful completion,
.Fn dirname
returns a pointer to the parent directory of
-.Ar path .
+.Fa path .
.Pp
If
.Fn dirname
.Dv MAXPATHLEN .
.El
.Sh WARNINGS
+The
.Fn dirname
+function
returns a pointer to internal static storage space that will be overwritten
by subsequent calls (each function has its own separate storage).
.Pp
.Fn dirname
may modify the contents of the string passed to
.Fn dirname ;
-this should be taken into account when writing code which calls this function
-if portability is desired.
+if portability is desired,
+this should be taken into account when writing code which calls this function.
+.Sh LEGACY SYNOPSIS
+.Fd #include <libgen.h>
+.Pp
+.Ft char *
+.br
+.Fo dirname
+.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 basename 3
+.Xr basename 3 ,
+.Xr compat 5
.Sh STANDARDS
The
.Fn dirname
and
.Fx 4.2 .
.Sh AUTHORS
-Todd C. Miller <Todd.Miller@courtesan.com>
+.An "Todd C. Miller" Aq Todd.Miller@courtesan.com