1 /* 2 // Copyright (C) 2022 Beken Corporation 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef _STR_PUB_H_ 16 #define _STR_PUB_H_ 17 18 #include <stdarg.h> 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 UINT32 os_strlen(const char *str); 25 26 INT32 os_strcmp(const char *s1, const char *s2); 27 28 INT32 os_strncmp(const char *s1, const char *s2, const UINT32 n); 29 30 INT32 os_snprintf(char *buf, UINT32 size, const char *fmt, ...); 31 32 INT32 os_vsnprintf(char *buf, UINT32 size, const char *fmt, va_list ap); 33 34 char *os_strncpy(char *out, const char *in, const UINT32 n); 35 36 UINT32 os_strtoul(const char *nptr, char **endptr, int base); 37 38 char *os_strcpy(char *out, const char *in); 39 40 char *os_strchr(const char *s, int c); 41 42 char *os_strdup(const char *s); 43 44 int os_strcasecmp(const char *s1, const char *s2); 45 46 int os_strncasecmp(const char *s1, const char *s2, size_t n); 47 48 char *os_strrchr(const char *s, int c); 49 50 char *os_strstr(const char *haystack, const char *needle); 51 52 size_t os_strlcpy(char *dest, const char *src, size_t siz); 53 54 char *strtok_r(char *str, const char *delim, char **saveptr); 55 56 #ifdef __cplusplus 57 } 58 #endif 59 60 #endif // _STR_PUB_H_ 61 62 // EOF 63