17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bdstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bdstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bdstevel@tonic-gate * with the License.
87c478bdstevel@tonic-gate *
97c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bdstevel@tonic-gate * See the License for the specific language governing permissions
127c478bdstevel@tonic-gate * and limitations under the License.
137c478bdstevel@tonic-gate *
147c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bdstevel@tonic-gate *
207c478bdstevel@tonic-gate * CDDL HEADER END
217c478bdstevel@tonic-gate */
227c478bdstevel@tonic-gate/*	Copyright (c) 1988 AT&T	*/
23b4203d7Marcel Telka/*	  All Rights Reserved	*/
247c478bdstevel@tonic-gate
257c478bdstevel@tonic-gate
267c478bdstevel@tonic-gate/*
27ba3594bGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org>
284870e0aRichard PALO * Copyright 2014 PALO, Richard.
29ba3594bGarrett D'Amore *
307c478bdstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
317c478bdstevel@tonic-gate * Use is subject to license terms.
327c478bdstevel@tonic-gate */
337c478bdstevel@tonic-gate
347c478bdstevel@tonic-gate/*
357c478bdstevel@tonic-gate * An application should not include this header directly.  Instead it
367c478bdstevel@tonic-gate * should be included only through the inclusion of other Sun headers.
377c478bdstevel@tonic-gate *
387c478bdstevel@tonic-gate * The contents of this header is limited to identifiers specified in the
397c478bdstevel@tonic-gate * C Standard.  Any new identifiers specified in future amendments to the
407c478bdstevel@tonic-gate * C Standard must be placed in this header.  If these new identifiers
417c478bdstevel@tonic-gate * are required to also be in the C++ Standard "std" namespace, then for
427c478bdstevel@tonic-gate * anything other than macro definitions, corresponding "using" directives
437c478bdstevel@tonic-gate * must also be added to <string.h>.
447c478bdstevel@tonic-gate */
457c478bdstevel@tonic-gate
467c478bdstevel@tonic-gate#ifndef _ISO_STRING_ISO_H
477c478bdstevel@tonic-gate#define	_ISO_STRING_ISO_H
487c478bdstevel@tonic-gate
497c478bdstevel@tonic-gate#include <sys/feature_tests.h>
504870e0aRichard PALO#include <sys/null.h>
517c478bdstevel@tonic-gate
527c478bdstevel@tonic-gate#ifdef	__cplusplus
537c478bdstevel@tonic-gateextern "C" {
547c478bdstevel@tonic-gate#endif
557c478bdstevel@tonic-gate
567c478bdstevel@tonic-gate#if __cplusplus >= 199711L
577c478bdstevel@tonic-gatenamespace std {
587c478bdstevel@tonic-gate#endif
597c478bdstevel@tonic-gate
607c478bdstevel@tonic-gate#if !defined(_SIZE_T) || __cplusplus >= 199711L
617c478bdstevel@tonic-gate#define	_SIZE_T
627c478bdstevel@tonic-gate#if defined(_LP64) || defined(_I32LPx)
637c478bdstevel@tonic-gatetypedef unsigned long	size_t;		/* size of something in bytes */
647c478bdstevel@tonic-gate#else
657c478bdstevel@tonic-gatetypedef unsigned int	size_t;		/* (historical version) */
667c478bdstevel@tonic-gate#endif
677c478bdstevel@tonic-gate#endif	/* !_SIZE_T */
687c478bdstevel@tonic-gate
697c478bdstevel@tonic-gateextern int memcmp(const void *, const void *, size_t);
707c478bdstevel@tonic-gateextern void *memcpy(void *_RESTRICT_KYWD, const void *_RESTRICT_KYWD, size_t);
717c478bdstevel@tonic-gateextern void *memmove(void *, const void *, size_t);
727c478bdstevel@tonic-gateextern void *memset(void *, int, size_t);
737c478bdstevel@tonic-gateextern char *strcat(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
747c478bdstevel@tonic-gateextern int strcmp(const char *, const char *);
757c478bdstevel@tonic-gateextern char *strcpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
767c478bdstevel@tonic-gateextern int strcoll(const char *, const char *);
777c478bdstevel@tonic-gateextern size_t strcspn(const char *, const char *);
787c478bdstevel@tonic-gateextern char *strerror(int);
797c478bdstevel@tonic-gateextern size_t strlen(const char *);
807c478bdstevel@tonic-gateextern char *strncat(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
817c478bdstevel@tonic-gateextern int strncmp(const char *, const char *, size_t);
827c478bdstevel@tonic-gateextern char *strncpy(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
837c478bdstevel@tonic-gateextern size_t strspn(const char *, const char *);
847c478bdstevel@tonic-gateextern char *strtok(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD);
857c478bdstevel@tonic-gateextern size_t strxfrm(char *_RESTRICT_KYWD, const char *_RESTRICT_KYWD, size_t);
867c478bdstevel@tonic-gate
877c478bdstevel@tonic-gate/*
887c478bdstevel@tonic-gate * The C++ Standard (ISO/IEC 14882:1998) specifies that each of the
897c478bdstevel@tonic-gate * function signatures for the following functions be replaced by
907c478bdstevel@tonic-gate * two declarations, both of which have the same behavior.
917c478bdstevel@tonic-gate */
927c478bdstevel@tonic-gate#if __cplusplus >= 199711L
937c478bdstevel@tonic-gateextern const void *memchr(const void *, int, size_t);
947c478bdstevel@tonic-gate#ifndef	_MEMCHR_INLINE
957c478bdstevel@tonic-gate#define	_MEMCHR_INLINE
967c478bdstevel@tonic-gateextern "C++" {
977c478bdstevel@tonic-gate	inline void *memchr(void * __s, int __c, size_t __n) {
987c478bdstevel@tonic-gate		return (void *)memchr((const void *)__s, __c, __n);
997c478bdstevel@tonic-gate	}
1007c478bdstevel@tonic-gate}
1017c478bdstevel@tonic-gate#endif  /* _MEMCHR_INLINE */
1027c478bdstevel@tonic-gateextern const char *strchr(const char *, int);
1037c478bdstevel@tonic-gate#ifndef _STRCHR_INLINE
1047c478bdstevel@tonic-gate#define	_STRCHR_INLINE
1057c478bdstevel@tonic-gateextern "C++" {
1067c478bdstevel@tonic-gate	inline char *strchr(char *__s, int __c) {
1077c478bdstevel@tonic-gate		return (char *)strchr((const char *)__s, __c);
1087c478bdstevel@tonic-gate	}
1097c478bdstevel@tonic-gate}
1107c478bdstevel@tonic-gate#endif	/* _STRCHR_INLINE */
1117c478bdstevel@tonic-gateextern const char *strpbrk(const char *, const char *);
1127c478bdstevel@tonic-gate#ifndef _STRPBRK_INLINE
1137c478bdstevel@tonic-gate#define	_STRPBRK_INLINE
1147c478bdstevel@tonic-gateextern "C++" {
1157c478bdstevel@tonic-gate	inline char *strpbrk(char *__s1, const char *__s2) {
1167c478bdstevel@tonic-gate		return (char *)strpbrk((const char *)__s1, __s2);
1177c478bdstevel@tonic-gate	}
1187c478bdstevel@tonic-gate}
1197c478bdstevel@tonic-gate#endif	/* _STRPBRK_INLINE */
1207c478bdstevel@tonic-gateextern const char *strrchr(const char *, int);
1217c478bdstevel@tonic-gate#ifndef _STRRCHR_INLINE
1227c478bdstevel@tonic-gate#define	_STRRCHR_INLINE
1237c478bdstevel@tonic-gateextern "C++" {
1247c478bdstevel@tonic-gate	inline char *strrchr(char *__s, int __c) {
1257c478bdstevel@tonic-gate		return (char *)strrchr((const char *)__s, __c);
1267c478bdstevel@tonic-gate	}
1277c478bdstevel@tonic-gate}
1287c478bdstevel@tonic-gate#endif	/* _STRRCHR_INLINE */
1297c478bdstevel@tonic-gateextern const char *strstr(const char *, const char *);
1307c478bdstevel@tonic-gate#ifndef _STRSTR_INLINE
1317c478bdstevel@tonic-gate#define	_STRSTR_INLINE
1327c478bdstevel@tonic-gateextern "C++" {
1337c478bdstevel@tonic-gate	inline char *strstr(char *__s1, const char *__s2) {
1347c478bdstevel@tonic-gate		return (char *)strstr((const char *)__s1, __s2);
1357c478bdstevel@tonic-gate	}
1367c478bdstevel@tonic-gate}
1377c478bdstevel@tonic-gate#endif	/* _STRSTR_INLINE */
1387c478bdstevel@tonic-gate#else /* __cplusplus >= 199711L */
1397c478bdstevel@tonic-gateextern void *memchr(const void *, int, size_t);
1407c478bdstevel@tonic-gateextern char *strchr(const char *, int);
1417c478bdstevel@tonic-gateextern char *strpbrk(const char *, const char *);
1427c478bdstevel@tonic-gateextern char *strrchr(const char *, int);
1437c478bdstevel@tonic-gateextern char *strstr(const char *, const char *);
1447c478bdstevel@tonic-gate#endif /* __cplusplus >= 199711L */
1457c478bdstevel@tonic-gate
1465097196Alexander Pyhalov#if __cplusplus >= 199711L
1475097196Alexander Pyhalov}
1485097196Alexander Pyhalov#endif /* end of namespace std */
1495097196Alexander Pyhalov
1505097196Alexander Pyhalov/*
1515097196Alexander Pyhalov * ISO C11 Annex K functions are not allowed to be in the standard
1525097196Alexander Pyhalov * namespace; however, it is implementation-defined as to whether or
1535097196Alexander Pyhalov * not they are in the global namespace and we opt to make them
1545097196Alexander Pyhalov * available to software.
1555097196Alexander Pyhalov */
15600efb5eYuri Pankov#if __EXT1_VISIBLE
15700efb5eYuri Pankov
15800efb5eYuri Pankov#ifndef	_RSIZE_T_DEFINED
15900efb5eYuri Pankov#define	_RSIZE_T_DEFINED
1605097196Alexander Pyhalov#if __cplusplus >= 199711L
1615097196Alexander Pyhalovtypedef std::size_t rsize_t;
1625097196Alexander Pyhalov#else
16300efb5eYuri Pankovtypedef size_t rsize_t;
16400efb5eYuri Pankov#endif
1655097196Alexander Pyhalov#endif
16600efb5eYuri Pankov
16700efb5eYuri Pankov#ifndef	_ERRNO_T_DEFINED
16800efb5eYuri Pankov#define	_ERRNO_T_DEFINED
16900efb5eYuri Pankovtypedef int errno_t;
17000efb5eYuri Pankov#endif
17100efb5eYuri Pankov
17200efb5eYuri Pankov/* ISO/IEC 9899:2011 K.3.7.4.1.1 */
17300efb5eYuri Pankovextern errno_t memset_s(void *, rsize_t, int, rsize_t);
17400efb5eYuri Pankov#endif	/* __EXT1_VISIBLE */
17500efb5eYuri Pankov
1767c478bdstevel@tonic-gate#ifdef	__cplusplus
1777c478bdstevel@tonic-gate}
1787c478bdstevel@tonic-gate#endif
1797c478bdstevel@tonic-gate
1807c478bdstevel@tonic-gate#endif	/* _ISO_STRING_ISO_H */
181