Date: Sun, 31 Mar 2002 15:21:57 +1000 (EST) From: "Tim J. Robbins" <tim@robbins.dropbear.id.au> To: FreeBSD-gnats-submit@FreeBSD.org Subject: standards/36559: XSI <strings.h> is incorrect Message-ID: <200203310521.g2V5LvFr003712@treetop.robbins.dropbear.id.au>
next in thread | raw e-mail | index | archive | help
>Number: 36559
>Category: standards
>Synopsis: XSI <strings.h> is incorrect
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-standards
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Mar 30 21:20:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Tim J. Robbins
>Release: FreeBSD 4.5-STABLE i386
>Organization:
>Environment:
System: FreeBSD treetop.robbins.dropbear.id.au 4.5-STABLE FreeBSD 4.5-STABLE #2: Sat Mar 30 20:10:51 EST 2002 tim@treetop.robbins.dropbear.id.au:/usr/obj/usr/src/sys/GENERIC i386
>Description:
<strings.h> is effectively an alias for <string.h>, which is not what the
P1003.1-2001 standard asks for (strings.h is an XSI extension).
>How-To-Repeat:
strings.h shouldn't define NULL, for example:
#include <strings.h>
int
main(void)
{
int NULL;
NULL = 0;
return (0);
}
>Fix:
Here is a proper <strings.h> header:
/*
* This file is in the public domain.
*
* $FreeBSD$
*/
#ifndef _STRINGS_H_
#define _STRINGS_H_
#include <sys/cdefs.h>
#include <machine/ansi.h>
#ifdef _BSD_SIZE_T_
typedef _BSD_SIZE_T_ size_t;
#undef _BSD_SIZE_T_
#endif
__BEGIN_DECLS
int bcmp(const void *, const void *, size_t);
void bcopy(const void *, void *, size_t);
void bzero(void *, size_t);
int ffs(int);
char *index(const char *, int);
char *rindex(const char *, int);
int strcasecmp(const char *, const char *);
int strncasecmp(const char *, const char *, size_t);
__END_DECLS
/*
* Previous versions of <strings.h> included <string.h>.
*/
#if !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 420L
#include <string.h>
#endif
#endif /* _STRINGS_H_ */
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203310521.g2V5LvFr003712>
