/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* bos72X src/bos/usr/include/string.h 1.28.6.10                          */
/*                                                                        */
/* Licensed Materials - Property of IBM                                   */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1985,2021              */
/* All Rights Reserved                                                    */
/*                                                                        */
/* US Government Users Restricted Rights - Use, duplication or            */
/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.      */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/* @(#)11  1.28.6.10  src/bos/usr/include/string.h, libcstr, bos72X, x2021_25A9 6/4/21 03:15:54 */ 
/*
 * COMPONENT_NAME: (LIBCSTR) Standard C Library String Handling Functions
 *
 * FUNCTIONS:
 *
 * ORIGINS: 27,71
 *
 * (C) COPYRIGHT International Business Machines Corp. 1985, 2000
 * All Rights Reserved
 * Licensed Materials - Property of IBM
 *
 * US Government Users Restricted Rights - Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 */

/*
 * (c) Copyright 1990, 1991, 1992 OPEN SOFTWARE FOUNDATION, INC. 
 * ALL RIGHTS RESERVED 
 */

#ifndef _H_STRING
#define _H_STRING

#ifndef _H_STANDARDS
#include <standards.h>
#endif /* _H_STANDARDS */

#include <comp_macros.h>

#if defined(__IBMCPP__) && !defined(__clang__)
# ifdef __cplusplus
#  include <sys/types.h>
#  ifdef __STR__
    inline char *_NOTHROW(strcpy, (char *, const char *));
    inline int   _NOTHROW(strcmp, (const char *, const char *));
#   ifndef __STR31__
     inline size_t _NOTHROW(strlen, (const char *));
     inline char  *_NOTHROW(strchr, (const char *, int ));
     inline char  *_NOTHROW(strrchr, (const char *, int ));
     inline char  *_NOTHROW(strcat, (char *, const char *));
     inline void  *_NOTHROW(memchr, (const void *, int , size_t));
     inline void  *_NOTHROW(memcpy, (void *, const void *, size_t));
     inline void  *_NOTHROW(memmove, (void *s1, const void *, size_t ));
     inline int    _NOTHROW(memcmp, (const void *, const void *, size_t ));
     inline void  *_NOTHROW(memset, (void *, int , size_t ));

     inline void  *_NOTHROW(memccpy, (void *, const void *, int , size_t));
     inline char  *_NOTHROW(strncat, (char *, const char *, size_t ));
     inline int   _NOTHROW(strncmp, (const char *, const char *, size_t ));
     inline char  *_NOTHROW(strncpy, (char *, const char *, size_t));

#    ifdef _ALL_SOURCE
      inline char  *_NOTHROW(index, (const char *, int ));
      inline char  *_NOTHROW(rindex, (const char *, int ));
#    endif /* _ALL_SOURCE */
#   endif /* ndef __STR31__ */
#  endif /* def __STR__ */
# endif /* __cplusplus */

# if __ORDERED__
#  undef _SIZE_T
# endif
#endif /* defined(__IBMCPP__) */

#ifndef _H_TYPES
#include <sys/types.h>
#endif /* _H_TYPES */

#ifdef __cplusplus
extern "C" {
#endif

/*
 *
 *      The ANSI standard requires that certain values be in string.h.
 *      It also requires that if _ANSI_C_SOURCE is defined then ONLY these
 *      values are present. This header includes all the ANSI required entries.
 *      In addition other entries for the XIX system are included.
 *
 */

#ifdef   _ANSI_C_SOURCE

/*
 *	The following definitions (NULL, size_t) are included in <sys/types.h>.
 *	They are also included here to comply with ANSI standards.
 */

#ifndef NULL
#define NULL	0
#endif /* NULL */

#ifndef _SIZE_T
#define _SIZE_T
	typedef unsigned long	size_t;
#endif /* _SIZE_T */

#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || defined(_ALL_SOURCE)
#ifndef __ERRNO_T
#define __ERRNO_T
	typedef int     errno_t;
#endif

#ifndef __RSIZE_T
#define __RSIZE_T
	typedef size_t  rsize_t;
#endif

#ifndef __RSIZE_MAX	
#define __RSIZE_MAX
#define RSIZE_MAX SIZE_MAX
#endif
#endif /*STDC_VERSION check ends here*/

#ifdef	_NONSTD_TYPES
	extern char	*_NOTHROW(memchr, ());
	extern char	*_NOTHROW(memcpy, ());
	extern char	*_NOTHROW(memset, ());
	extern int	_NOTHROW(strcspn, ());
	extern int	_NOTHROW(strlen, ());
	extern int	_NOTHROW(strspn, ());
#elif	defined	_NO_PROTO
	extern void	*_NOTHROW(memchr, ());
	extern void	*_NOTHROW(memcpy, ());
	extern void	*_NOTHROW(memset, ());
#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || defined(_ALL_SOURCE)
	extern errno_t  memset_s();
#endif 
	extern size_t 	_NOTHROW(strcspn, ());
	extern size_t	_NOTHROW(strlen, ());
	extern size_t	_NOTHROW(strspn, ());
#else	/* _NONSTD_TYPES, _NO_PROTO */
#ifdef __cplusplus98__interface__
	extern const void	*_NOTHROW(memchr, (const void *, int, size_t)); 
	extern void		*_NOTHROW(memchr, (      void *, int, size_t));
#else
        extern void     	*_NOTHROW(memchr, (const void *, int, size_t));
#endif
	extern void     *_NOTHROW(memcpy, (void * __restrict__, const void * __restrict__, size_t));
        extern void     *_NOTHROW(memset, (void *, int, size_t));
#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || defined(_ALL_SOURCE)
	extern errno_t  memset_s(void *, rsize_t, int, rsize_t);
#endif 
        extern size_t   _NOTHROW(strcspn, (const char *, const char *));
        extern size_t   _NOTHROW(strlen, (const char *));
        extern size_t   _NOTHROW(strspn, (const char *, const char *));
#endif	/* _NONSTD_TYPES, _NO_PROTO */

#ifndef _LOCALE_T
#define _LOCALE_T
	typedef void * locale_t;
#endif

#ifdef   _NO_PROTO
	extern void 	*_NOTHROW(memmove, ());
	extern char 	*_NOTHROW(strcpy, ());
	extern char 	*_NOTHROW(strncpy, ());
	extern char 	*_NOTHROW(strcat, ());
	extern char	*_NOTHROW(strncat, ());
	extern int 	_NOTHROW(memcmp, ());
	extern int	_NOTHROW(strcmp, ());
	extern int	strncollen();
	extern int	_NOTHROW(strncmp, ());
	extern char	*_NOTHROW(strchr, ());
	extern char	*_NOTHROW(strpbrk, ());
	extern char	*_NOTHROW(strrchr, ());
	extern char	*_NOTHROW(strstr, ());
	extern char 	*_NOTHROW(strtok, ());
	extern char 	*_NOTHROW(strerror, ());
	extern int	_NOTHROW(strcoll, ());
	extern size_t _NOTHROW(strxfrm, ());
#if (_XOPEN_SOURCE >= 700)
	extern int  _NOTHROW(strcoll_l, ());
	extern size_t _NOTHROW(strxfrm_l, ());
        extern char *_NOTHROW(strerror_l, ());
#endif	
	extern char *_NOTHROW(strtok_r, ());
#if defined(_THREAD_SAFE) || (_XOPEN_SOURCE >= 600)
	    extern int	_NOTHROW(strerror_r, ());
#endif /* _THREAD_SAFE || _XOPEN_SOURCE >= 600 */

#else  /*_NO_PROTO */
#ifdef __cplusplus98__interface__
	extern const char	*_NOTHROW(strchr, (const char *, int));
	extern char		*_NOTHROW(strchr, (      char *, int));
	extern const char	*_NOTHROW(strpbrk, (const char *, const char *));
	extern char		*_NOTHROW(strpbrk, (      char *,       char *));
	extern const char	*_NOTHROW(strrchr, (const char *, int));
	extern char		*_NOTHROW(strrchr, (      char *, int));
	extern const char	*_NOTHROW(strstr, (const char *, const char *));
	extern char		*_NOTHROW(strstr, (      char *,       char *));
#else
	extern char		*_NOTHROW(strchr, (const char *, int));
	extern char		*_NOTHROW(strpbrk, (const char *, const char *));
	extern char		*_NOTHROW(strrchr, (const char *, int));
	extern char		*_NOTHROW(strstr, (const char *, const char *));

#endif
        extern void     *_NOTHROW(memmove, (void *, const void *, size_t));
        extern char     *_NOTHROW(strcpy, (char * __restrict__, const char * __restrict__));
        extern char     *_NOTHROW(strncpy, (char * __restrict__, const char * __restrict__, size_t));
        extern char     *_NOTHROW(strcat, (char * __restrict__, const char * __restrict__));
        extern char     *_NOTHROW(strncat, (char * __restrict__, const char * __restrict__, size_t));
        extern int      _NOTHROW(memcmp, (const void *, const void *,size_t));
        extern int      _NOTHROW(strcmp, (const char *, const char *));
        extern int      _NOTHROW(strncmp, (const char *,const char *,size_t));
        extern int      strncollen(const char *, const int );
        extern char     *_NOTHROW(strtok, (char * __restrict__, const char * __restrict__));
        extern char     *_NOTHROW(strerror, (int));
        extern int      _NOTHROW(strcoll, (const char *, const char *));
        extern size_t _NOTHROW(strxfrm, (char * __restrict__, const char * __restrict__, size_t));
#if (_XOPEN_SOURCE >= 700)
		extern int      _NOTHROW(strcoll_l, (const char *, const char *, locale_t));
		extern size_t _NOTHROW(strxfrm_l, (char * __restrict__, const char * __restrict__, size_t, locale_t));
		extern  char *_NOTHROW(strerror_l, (int ,locale_t));
#endif		
		extern char *_NOTHROW(strtok_r, (char *, const char *, char **));
#if defined(_THREAD_SAFE) || (_XOPEN_SOURCE >= 600)
	    extern int	_NOTHROW(strerror_r, (int, char *, size_t));
#endif /* _THREAD_SAFE || _XOPEN_SOURCE >= 600 */

#endif /*_NO_PROTO */
#endif /*_ANSI_C_SOURCE */

#ifdef	_XOPEN_SOURCE
#ifdef	_NONSTD_TYPES
	extern char	*_NOTHROW(memccpy, ());
#elif	defined	_NO_PROTO
	extern void	*_NOTHROW(memccpy, ());
#else	/* _NONSTD_TYPES, _NO_PROTO */
        extern void     *_NOTHROW(memccpy, (void * __restrict__, const void * __restrict__, int, size_t));
#endif	/* _NONSTD_TYPES, _NO_PROTO */


#if _XOPEN_SOURCE_EXTENDED==1

#ifdef _NO_PROTO
extern char *_NOTHROW(strdup, ());
#else /* _NO_PROTO */
extern char *_NOTHROW(strdup, (const char *));
#endif /* _NO_PROTO */

#endif /* _XOPEN_SOURCE_EXTENDED */

#endif	/* _XOPEN_SOURCE */

#if (_XOPEN_SOURCE >= 700)
#ifdef  _NO_PROTO 
	extern char *   _NOTHROW(strndup, ());
        extern int      _NOTHROW(strnlen, ());
	extern char *   _NOTHROW(stpcpy, ());
        extern char *   _NOTHROW(stpncpy, ());
#else /* NO PROTO */
        extern char *   _NOTHROW(strndup, (const char *, size_t));
        extern size_t   _NOTHROW(strnlen, (const char *, size_t));
        extern char *   _NOTHROW(stpcpy, (char *, const char *));
        extern char *   _NOTHROW(stpncpy, (char *, const char *, size_t));
#endif /*NO PROTO */
#endif /* _XOPEN_SOURCE */

/* Defect  1081697 : UNIXv7 support for strsignal() */
#if defined(_ALL_SOURCE) || (_XOPEN_SOURCE >= 700)
#ifdef _NO_PROTO
	extern char *	_NOTHROW(strsignal, ());
#else /* NO PROTO */
	extern char *	_NOTHROW(strsignal, (int));
#endif /*NO PROTO */
#endif /* _XOPEN_SOURCE */        

#ifdef	_ALL_SOURCE
#ifdef	_NO_PROTO
#ifndef _INDEX_MACROS
	extern char     *_NOTHROW(index, ());
	extern char     *_NOTHROW(rindex, ());
#endif
	extern void	_NOTHROW(swab, ());
	extern wchar_t	*_NOTHROW(wcscat, ());
	extern wchar_t	*_NOTHROW(wcschr, ());
	extern int	_NOTHROW(wcscmp, ());
	extern wchar_t	*_NOTHROW(wcscpy, ());
	extern size_t	_NOTHROW(wcscspn, ());
	extern size_t	_NOTHROW(wcslen, ());
	extern wchar_t	*_NOTHROW(wcsncat, ());
	extern int	_NOTHROW(wcsncmp, ());
	extern wchar_t	*_NOTHROW(wcsncpy, ());
	extern wchar_t	*_NOTHROW(wcspbrk, ());
	extern wchar_t	*_NOTHROW(wcsrchr, ());
	extern size_t	_NOTHROW(wcsspn, ());
	extern wchar_t	*_NOTHROW(wcswcs, ());
	extern int	_NOTHROW(wcswidth, ());
	extern int	_NOTHROW(wcwidth, ());
	extern int	_NOTHROW(wcscoll, ());
	extern size_t	_NOTHROW(wcsxfrm, ());
#if (_XOPEN_SOURCE >= 700)
extern int  _NOTHROW(wcscoll_l, ());
extern size_t   _NOTHROW(wcsxfrm_l, ());
#endif	
	extern char	*__linux_strerror_r();
	extern char *	_NOTHROW(strsep, ());
	extern void *	_NOTHROW(memmem, ());
#ifdef _THREAD_SAFE
	extern int 	dirname_r();
#endif   /* _THREAD_SAFE */
#ifndef _STRCASECMP_DEF
#define _STRCASECMP_DEF
	extern int	_NOTHROW(strcasecmp, ());
	extern int	_NOTHROW(strncasecmp, ());
#endif /* _STRCASECMP_DEF */
#else	/*_NO_PROTO */
#ifdef __cplusplus98__interface__
	extern const wchar_t	*_NOTHROW(wcschr, (const wchar_t *, wchar_t));
	extern wchar_t		*_NOTHROW(wcschr, (      wchar_t *, wchar_t));
	extern const wchar_t	*_NOTHROW(wcspbrk, (const wchar_t *, const wchar_t *));
	extern wchar_t		*_NOTHROW(wcspbrk, (      wchar_t *,       wchar_t *));
	extern const wchar_t	*_NOTHROW(wcsrchr, (const wchar_t *, wchar_t));
	extern wchar_t		*_NOTHROW(wcsrchr, (      wchar_t *, wchar_t));
#else
	extern wchar_t		*_NOTHROW(wcschr, (const wchar_t *, wchar_t));
	extern wchar_t		*_NOTHROW(wcspbrk, (const wchar_t *, const wchar_t *));
	extern wchar_t		*_NOTHROW(wcsrchr, (const wchar_t *, wchar_t));
#endif
#ifndef _INDEX_MACROS
        extern char     *_NOTHROW(index, (const char *, int));
        extern char     *_NOTHROW(rindex, (const char *, int));
#endif
	extern void     _NOTHROW(swab, (const void *, void *, ssize_t));
        extern wchar_t  *_NOTHROW(wcscat, (wchar_t *, const wchar_t *));
        extern int      _NOTHROW(wcscmp, (const wchar_t *, const wchar_t *));
        extern wchar_t  *_NOTHROW(wcscpy, (wchar_t *, const wchar_t *));
        extern size_t   _NOTHROW(wcscspn, (const wchar_t *, const wchar_t *));
        extern size_t   _NOTHROW(wcslen, (const wchar_t *));
        extern wchar_t  *_NOTHROW(wcsncat, (wchar_t *, const wchar_t *, size_t));
        extern int      _NOTHROW(wcsncmp, (const wchar_t *, const wchar_t *, size_t));
        extern wchar_t  *_NOTHROW(wcsncpy, (wchar_t *, const wchar_t *, size_t));
        extern size_t   _NOTHROW(wcsspn, (const wchar_t *, const wchar_t *));
        extern wchar_t  *_NOTHROW(wcswcs, (const wchar_t *, const wchar_t *));
        extern int      _NOTHROW(wcswidth, (const wchar_t *, size_t));
        extern int      _NOTHROW(wcwidth, (wchar_t));
        extern int      _NOTHROW(wcscoll, (const wchar_t *, const wchar_t *));
        extern size_t	_NOTHROW(wcsxfrm, (wchar_t *, const wchar_t *, size_t));
#if (_XOPEN_SOURCE >= 700)
		extern int      _NOTHROW(wcscoll_l, (const wchar_t *, const wchar_t *, locale_t));
		extern size_t   _NOTHROW(wcsxfrm_l, (wchar_t *, const wchar_t *, size_t, locale_t));
#endif		
		extern char	*__linux_strerror_r(int, char *, size_t);
	extern char *	_NOTHROW(strsep, (char **, const char *));
	extern void *	_NOTHROW(memmem, (const void *, size_t, const void *, size_t));
#ifdef _THREAD_SAFE
	extern int 	dirname_r(char *path, char *buf, int size);
#endif   /* _THREAD_SAFE */
#ifndef _STRCASECMP_DEF
#define _STRCASECMP_DEF
	extern int	_NOTHROW(strcasecmp, (const char *, const char *));
	extern int	_NOTHROW(strncasecmp, (const char *, const char *, size_t));
#endif /* _STRCASECMP_DEF */
#endif	/* _NO_PROTO */

#ifndef __cplusplus
#ifdef __STR__
#   ifndef __STR31__
#      define _INDEX_MACROS
#      define index(__s1,__c) __strchr(__s1,__c)
#      define rindex(__s1,__c) __strrchr(__s1,__c)
#   endif /* ifndef __STR31__ */
#endif /* __STR__ */
#endif /* __cplusplus */

#ifdef _LINUX_SOURCE_COMPAT
#define strerror_r(a, b, c) __linux_strerror_r((a), (b), (c))
#endif

#endif	/* _ALL_SOURCE */

/*
 *   The following macro definitions cause the XLC compiler to inline
 *   these functions whenever possible.
 */
 
#ifndef __cplusplus
#ifdef __STR__
#   define strcpy(__s1,__s2) __strcpy(__s1,__s2)
#   define strcmp(__s1,__s2) __strcmp(__s1,__s2)

#   ifndef __STR31__
#       define strlen(__s1) __strlen(__s1)
#       define strchr(__s1,__c) __strchr(__s1,__c)
#       define strrchr(__s1,__c) __strrchr(__s1,__c)
#       define strcat(__s1,__s2) __strcat(__s1,__s2)
#       define memchr(__s1,__c,__n) __memchr(__s1,__c,__n)
#       define memcpy(__s1,__s2,__n) __memcpy(__s1,__s2,__n)
#       define memmove(__s1,__s2,__n) __memmove(__s1,__s2,__n)
#       define memcmp(__s1,__s2,__n) __memcmp(__s1,__s2,__n)
#       define memset(__s1,__c,__n) __memset(__s1,__c,__n)
/*
 *   __XLC121__ is automatically defined by the XLC 1.2.1 compiler so that
 *   the compiler can inline the following functions when possible.
 */
#     ifdef __XLC121__
#       define memccpy(__target,__source,__c,__n)  __memccpy(__target,__source,__c,__n)
#       define strncat(__s1, __s2, __n)    __strncat(__s1, __s2, __n)
#       define strncmp(__s1, __s2, __n)    __strncmp(__s1, __s2, __n)
#       define strncpy(__s1, __s2, __n)    __strncpy(__s1, __s2, __n)
#     endif /*__XLC121__ */
#   endif /* ifndef __STR31__ */
#endif /* __STR__ */
#endif /* __cplusplus */

#ifdef __cplusplus
}
#endif

#if defined(__IBMCPP__)
# ifdef __STR__
#  define __STR__ 1
  
#if !defined(__clang__)
   extern "builtin" char *__strcpy(char *, const char *);
   extern "builtin" int   __strcmp(const char *, const char *);
#endif

   inline char *_NOTHROW(strcpy, (char *__s1, const char *__s2))
     { return __strcpy (__s1, __s2);}
   inline int   _NOTHROW(strcmp, (const char *__s1, const char *__s2))
     { return __strcmp (__s1, __s2);}

#  ifndef __STR31__
#if !defined(__clang__)
    extern "builtin" size_t __strlen(const char *);
    extern "builtin" char *__strchr(const char *, int );
    extern "builtin" char *__strrchr(const char *, int );
    extern "builtin" char  *__strcat(char *, const char *);
    extern "builtin" void  *__memchr(const void *, int , size_t );
    extern "builtin" void  *__memcpy(void *, const void *, size_t );
    extern "builtin" void  *__memmove(void *, const void *, size_t );
    extern "builtin" int __memcmp(const void *, const void *, size_t );
    extern "builtin" void  *__memset(void *, int , size_t );
  
    extern "builtin" void  *__memccpy(void *, const void *, int , size_t );
    extern "builtin" char  *__strncat(char *, const char *, size_t );
    extern "builtin" int  __strncmp(const char *, const char *, size_t );
    extern "builtin" char  *__strncpy(char *, const char *, size_t );
#endif /* !defined(__clang__) */

    inline size_t _NOTHROW(strlen, (const char *__s))
      { return __strlen (__s); }
    inline char  *_NOTHROW(strchr, (const char *__s, int __c))
      { return __strchr (__s, __c); }
    inline char  *_NOTHROW(strrchr, (const char *__s, int __c))
      { return __strrchr (__s, __c); }
    inline char  *_NOTHROW(strcat, (char *__s1, const char *__s2))
      { return __strcat (__s1, __s2); }
    inline void  *_NOTHROW(memchr, (const void *__s, int __c, size_t __n))
      { return __memchr (__s, __c, __n); }
    inline void  *_NOTHROW(memcpy, (void *__s1, const void *__s2, size_t __n))
      { return __memcpy (__s1, __s2, __n); }
    inline void  *_NOTHROW(memmove, (void *__s1, const void *__s2, size_t __n))
      { return __memmove (__s1, __s2, __n); }
    inline int    _NOTHROW(memcmp, (const void *__s1, const void *__s2, size_t __n))
      { return __memcmp (__s1, __s2, __n); }
    inline void  *_NOTHROW(memset, (void *__s, int __c, size_t __n))
      { return __memset (__s, __c, __n); }
  
    inline void  *_NOTHROW(memccpy, (void *__target, const void *__source, int __c, size_t __n))
      { return __memccpy (__target, __source, __c, __n); }
    inline char  *_NOTHROW(strncat, (char *__s1, const char *__s2, size_t __n))
      { return __strncat (__s1, __s2, __n); }
    inline int   _NOTHROW(strncmp, (const char *__s1, const char *__s2, size_t __n))
      { return __strncmp (__s1, __s2, __n); }
    inline char  *_NOTHROW(strncpy, (char *__s1, const char *__s2, size_t __n))
      { return __strncpy (__s1, __s2, __n); }

#   ifdef   _ALL_SOURCE
#ifndef _INDEX_MACROS
#define _INDEX_MACROS
     inline char  *_NOTHROW(index, (const char *__s, int __c))
       {return __strchr(__s, __c);}
     inline char  *_NOTHROW(rindex, (const char *__s, int __c))
       {return __strrchr(__s, __c);}
#endif
#   endif /* def _ALL_SOURCE */
#  endif /* ndef __STR31__ */
# endif /* def __STR__ */
#endif /* defined(__IBMCPP__) */

#endif /* _H_STRING */
