svn commit: r213002 - in stable/8: include lib/libc/gen

Rui Paulo rpaulo at freebsd.org
Fri Sep 24 06:14:18 UTC 2010


On 22 Sep 2010, at 22:08, Bruce Evans wrote:

> On Wed, 22 Sep 2010, Rui Paulo wrote:
> 
>> Log:
>> MFC r197804 (rwatson):
>>   Add basename_r(3) to complement basename(3).  basename_r(3) which accepts
>>   a caller-allocated buffer of at least MAXPATHLEN, rather than using a
>>   global buffer.
> 
> MAXPATHLEN has been deprecated for more than 20 years.  Please don't use
> it in new interfaces.  A few man pages, not including basename.3, have
> been updated to spell it PATH_MAX (should be {PATH_MAX}).

I'm not going to fix this because the interface will most likely change to something that doesn't require PATH_MAX. But thanks for pointing this out.

> 
>> Note about semantics: while this interface is not POSIXy, there's
>> another major platform that uses it (Android) and the semantics between
>> the two platforms are pretty much the same.
> 
> It is also not non-POSIX...
> 
>> Modified: stable/8/include/libgen.h
>> ==============================================================================
>> --- stable/8/include/libgen.h	Wed Sep 22 16:54:22 2010	(r213001)
>> +++ stable/8/include/libgen.h	Wed Sep 22 18:00:34 2010	(r213002)
>> @@ -36,6 +36,7 @@
>> __BEGIN_DECLS
>> 
>> char	*basename(const char *);
>> +char	*basename_r(const char *, char *);
>> char	*dirname(const char *);
>> #if 0
>> char	*regcmp(const char *, ...);
>> 
> 
> ...since it is declared in the POSIX namespace.

I don't know of a better place to declare it.

Regards,
--
Rui Paulo




More information about the svn-src-stable-8 mailing list