1 .\" $OpenBSD: basename.3,v 1.20 2007/05/31 19:19:28 jmc Exp $
3 .\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
5 .\" Permission to use, copy, modify, and distribute this software for any
6 .\" purpose with or without fee is hereby granted, provided that the above
7 .\" copyright notice and this permission notice appear in all copies.
9 .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 .Nd extract the base portion of a pathname
26 .Fn basename "char *path"
30 function returns the last component from the pathname pointed to by
35 .Sh IMPLEMENTATION NOTES
36 This implementation of
38 uses the buffer provided by the caller to store the resulting pathname
40 Other vendor implementations may return a pointer to internal storage
42 The advantage of the former approach is that it ensures thread-safety,
43 while also placing no upper limit on the supported length of the
50 characters, a pointer to the string
55 is a null pointer or the empty string, a pointer to the string
59 it returns a pointer to the last component of
73 function first appeared in
80 this function was reimplemented to store its result in the provided
82 There is no longer any need to use the
86 .An Nuxi, the Netherlands