version 1.4.10.3, 2002/03/22 20:42:06 |
version 1.4.10.4, 2002/11/11 22:22:04 |
|
|
.\" $NetBSD$ |
.\" $NetBSD$ |
.\" |
.\" |
.\" Copyright (c) 1997 The NetBSD Foundation, Inc. |
.\" Copyright (c) 1997, 2002 The NetBSD Foundation, Inc. |
.\" All rights reserved. |
.\" All rights reserved. |
.\" |
.\" |
.\" This code is derived from software contributed to The NetBSD Foundation |
.\" This code is derived from software contributed to The NetBSD Foundation |
.\" by Klaus Klein. |
.\" by Klaus Klein and Jason R. Thorpe. |
.\" |
.\" |
.\" Redistribution and use in source and binary forms, with or without |
.\" Redistribution and use in source and binary forms, with or without |
.\" modification, are permitted provided that the following conditions |
.\" modification, are permitted provided that the following conditions |
|
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
.\" POSSIBILITY OF SUCH DAMAGE. |
.\" POSSIBILITY OF SUCH DAMAGE. |
.\" |
.\" |
.Dd November 2, 1997 |
.Dd October 16, 2002 |
.Dt DIRNAME 3 |
.Dt DIRNAME 3 |
.Os |
.Os |
.Sh NAME |
.Sh NAME |
Line 53 function takes a pointer to a character |
|
Line 53 function takes a pointer to a character |
|
.Ar path , |
.Ar path , |
and returns a pointer to a string that is a pathname of the parent directory of |
and returns a pointer to a string that is a pathname of the parent directory of |
.Ar path . |
.Ar path . |
Trailing '/' characters in |
Trailing |
|
.Sq / |
|
characters in |
.Ar path |
.Ar path |
are not counted as part of the path. |
are not counted as part of the path. |
.Pp |
.Pp |
If |
If |
.Ar path |
.Ar path |
does not contain a '/', then |
does not contain a |
|
.Sq / , |
|
then |
.Fn dirname |
.Fn dirname |
returns a pointer to the string ".". |
returns a pointer to the string |
|
.Dq \&. . |
.Pp |
.Pp |
If |
If |
.Ar path |
.Ar path |
is a null pointer or points to an empty string, |
is a null pointer or points to an empty string, |
.Fn dirname |
.Fn dirname |
returns a pointer to the string ".". |
returns a pointer to the string |
|
.Dq \&. . |
.Sh RETURN VALUES |
.Sh RETURN VALUES |
The |
The |
.Fn dirname |
.Fn dirname |
Line 79 function returns a pointer to a string t |
|
Line 85 function returns a pointer to a string t |
|
.Bl -bullet -compact |
.Bl -bullet -compact |
.It |
.It |
.St -xpg4.2 |
.St -xpg4.2 |
|
.It |
|
.St -p1003.1-2001 |
.El |
.El |
.Sh BUGS |
.Sh BUGS |
|
If the length of the result is longer than |
|
.Dv PATH_MAX |
|
bytes |
|
.Pq including the terminating nul , |
|
the result will be truncated. |
|
.Pp |
The |
The |
.Fn dirname |
.Fn dirname |
function may modify the string pointed to by |
function returns a pointer to static storage that may be overwritten |
.Ar path . |
by subsequent calls to |
|
.Fn dirname . |
|
This is not strictly a bug; it is explicitly allowed by |
|
.St -p1003.1-2001 . |