1 /*
2  * Copyright © 2024 Keith Packard <keithp@keithp.com>
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_STRING_H_
8 #define ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_STRING_H_
9 
10 /* This should work on GCC and clang.
11  *
12  * If we need to support a toolchain without #include_next the CMake
13  * infrastructure should be used to identify it and provide an
14  * alternative solution.
15  */
16 #include_next <string.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /*
23  * Define these two Zephyr APIs when _POSIX_C_SOURCE is not set to expose
24  * them from newlib
25  */
26 #if !__MISC_VISIBLE && !__POSIX_VISIBLE
27 char *strtok_r(char *__restrict, const char *__restrict, char **__restrict);
28 #endif
29 #if __POSIX_VISIBLE < 200809L
30 size_t strnlen(const char *, size_t);
31 #endif
32 
33 #ifdef __cplusplus
34 }
35 #endif
36 
37 #endif /* ZEPHYR_LIB_LIBC_NEWLIB_INCLUDE_STRING_H_ */
38