[patch] make sure strings.h gets used if __USE_BSD is not defined

Ben Collins bcollins@debian.org
Mon Jan 1 23:39:00 GMT 2001


This program will give warnings about undefined reference to
strcasecmp(). The logic in string.h and strings.h is that the strings.h
declerations are not used if string.h was already included. This breaks
when __USE_BSD isn't defined, since the definitions in string.h depend
on that interface. So, this patch makes it round out that logic.

#define _XOPEN_SOURCE 500
#include <string.h>
#include <strings.h>

int main(void) {
    return strcasecmp("asdf", "asdf");
}
strcasecmp-test.c:6: warning: implicit declaration of function `strcasecmp'

I can come up with a test for all of the functions in strings.h under this
situation, if you think it's needed. There might actually need to be
some better coherency between these two files. Would it be better to
have something like this in string.h:

#ifdef __USE_BSD
#include <strings.h>
#endif

??

2001-01-01  Ben Collins  <bcollins@debian.org>

	* string/strings.h: Make sure we declare our functions even if
	  string.h is already included, based on whether or not
	  __USE_BSD is defined.

-- 
 -----------=======-=-======-=========-----------=====------------=-=------
/  Ben Collins  --  ...on that fantastic voyage...  --  Debian GNU/Linux   \
`  bcollins@debian.org  --  bcollins@openldap.org  --  bcollins@linux.com  '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'


More information about the Libc-alpha mailing list