DPDK  19.02.0
rte_string_fns.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 
11 #ifndef _RTE_STRING_FNS_H_
12 #define _RTE_STRING_FNS_H_
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <stdio.h>
19 #include <string.h>
20 
47 int
48 rte_strsplit(char *string, int stringlen,
49  char **tokens, int maxtokens, char delim);
50 
56 static inline size_t
57 rte_strlcpy(char *dst, const char *src, size_t size)
58 {
59  return (size_t)snprintf(dst, size, "%s", src);
60 }
61 
62 /* pull in a strlcpy function */
63 #ifdef RTE_EXEC_ENV_BSDAPP
64 #ifndef __BSD_VISIBLE /* non-standard functions are hidden */
65 #define strlcpy(dst, src, size) rte_strlcpy(dst, src, size)
66 #endif
67 
68 #else /* non-BSD platforms */
69 #ifdef RTE_USE_LIBBSD
70 #include <bsd/string.h>
71 
72 #else /* no BSD header files, create own */
73 #define strlcpy(dst, src, size) rte_strlcpy(dst, src, size)
74 
75 #endif /* RTE_USE_LIBBSD */
76 #endif /* BSDAPP */
77 
98 ssize_t
99 rte_strscpy(char *dst, const char *src, size_t dsize);
100 
101 #ifdef __cplusplus
102 }
103 #endif
104 
105 #endif /* RTE_STRING_FNS_H */