[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#729436: [libc6-dev] strcasecmp declared twice



reassign 729436 manpages-dev
retitle 729436 manpages-dev: please explain why strcasecmp(3) is defined in both <string.h> and <strings.h>
thanks


On Tue, Nov 12, 2013 at 10:26:56PM +0200, Török Edwin wrote:
> Package: libc6-dev
> Version: 2.17-93
> Severity: normal
> 
> --- Please enter the report below this line. ---
> 
> According to strcasecmp(3) and strcasecmp(3p) the function strcasecmp should be declared in strings.h.
> 
> However it is actually declared both in string.h and strings.h:
> /usr/include/string.h:extern int strcasecmp (const char *__s1, const char *__s2)
> /usr/include/string.h:extern int strcasecmp_l (const char *__s1, const char *__s2,
> /usr/include/strings.h:extern int strcasecmp (const char *__s1, const char *__s2)
> /usr/include/strings.h:extern int strcasecmp_l (const char *__s1, const char *__s2, __locale_t __loc)
> 
> If the declaration in string.h is a typo, please remove it.

This is not a typo, but there for historical reasons. The strcasecmp()
and strncasecmp() functions first appeared in 4.4BSD and have been
introduced the same way in the GNU libc. Their prototypes existed
previously in <string.h> before they were moved to <strings.h> for 
IEEE Std 1003.1-2001 (POSIX.1) compliance, as <string.h> is supposed to
be for ISO C functions, and strcasecmp() is not an ISO C function. The
prototype in <string.h> has been kept for compatibility reasons.

> Otherwise please update the manpage to mention that on Linux the function is actually declared in both string.h and strings.h, and you should check yourself that you included strings.h because you won't get any warning from the compiler about implicit declarations.
> 

I am therefore reassigning this bug to the manpages-dev package to
update the corresponding manpage.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net


Reply to: