4 * API declarations for POSIX.1-2008 string functions supported by MinGW.
8 * Written by Keith Marshall <keith@users.osdn.me>
9 * Copyright (C) 2015-2017, 2022, MinGW.OSDN Project
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
19 * The above copyright notice, this permission notice, and the following
20 * disclaimer shall be included in all copies or substantial portions of
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
29 * DEALINGS IN THE SOFTWARE.
33 #pragma GCC system_header
35 /* In addition to the POSIX strcasecmp() and strncasecmp() functions,
36 * this header declares the prototypes for the MSVC specific stricmp()
37 * and strincmp() functions, which MSVC expects to find in <string.h>;
38 * thus, we support selective partial inclusion by <string.h>, to make
39 * this pair of function prototypes available as MSVC expects...
41 #ifndef __STRING_H_SOURCED__
42 /* ...and we define the _STRINGS_H guard macro only when NOT included
43 * in this partial fashion.
47 /* All MinGW system headers must include <_mingw.h>; if we had been
48 * sourced by <string.h>, we could safely assume that it had already
49 * done this, but since that doesn't apply in this case, we must do
55 /* POSIX.1-2008 requires this header to expose the typedef for size_t; to
56 * ensure consistency, we import this from GCC's own <stddef.h> header.
63 int __cdecl __MINGW_NOTHROW strcasecmp( const char *, const char * );
64 int __cdecl __MINGW_NOTHROW strncasecmp( const char *, const char *, size_t );
66 #endif /* ! RC_INVOKED */
67 #endif /* !__STRING_H_SOURCED__ */
69 #if ! (defined __STRICT_ANSI__ && defined __NO_INLINE__)
70 /* These are the MSVCRT.DLL equivalents for POSIX.1's strcasecmp() and
71 * strncasecmp() functions, for which we provide in-line implementations
72 * in <strings.h> respectively; MSVC expects to find these prototypes in
73 * <string.h>, but we also need them here, in <strings.h>, to facilitate
74 * the in-line function implementations; we declare them here, and allow
75 * <string.h> to include them selectively. Note that <string.h> doesn't
76 * need these if __STRICT_ANSI__ is defined, while <strings.h> doesn't
77 * if __NO_INLINE__ is defined; thus we declare them, unless BOTH of
78 * these conditions for not requiring them are satisfied.
80 _CRTIMP __cdecl __MINGW_NOTHROW int _stricmp( const char *, const char * );
81 _CRTIMP __cdecl __MINGW_NOTHROW int _strnicmp( const char *, const char *, size_t );
82 #endif /* !(__STRICT_ANSI__ && __NO_INLINE__) */
84 #if defined _STRINGS_H && ! defined RC_INVOKED
86 /* Provide in-line implementations for strcasecmp(), and strncasecmp(),
87 * effectively aliasing them to the respective MSVCRT.DLL (non-standard)
88 * equivalents, as prototyped above.
90 __CRT_ALIAS __JMPSTUB__(( FUNCTION = strcasecmp, REMAPPED = _stricmp ))
91 int strcasecmp( const char *__s1, const char *__s2 )
92 { return _stricmp( __s1, __s2 ); }
94 __CRT_ALIAS __JMPSTUB__(( FUNCTION = strncasecmp, REMAPPED = _strnicmp ))
95 int strncasecmp( const char *__s1, const char *__s2, size_t __n )
96 { return _strnicmp( __s1, __s2, __n ); }
98 #endif /* !__NO_INLINE__ */
102 #endif /* _STRINGS_H && ! RC_INVOKED */
103 #endif /* !_STRINGS_H: $RCSfile$: end of file */