20 |
20 |
21 #include "core/bitmath_func.hpp" |
21 #include "core/bitmath_func.hpp" |
22 #include "string_type.h" |
22 #include "string_type.h" |
23 |
23 |
24 /** |
24 /** |
25 * usage ttd_strlcpy(dst, src, lengthof(dst)); |
25 * Appends characters from one string to another. |
26 * @param dst destination buffer |
26 * |
27 * @param src string to copy/concatenate |
27 * Appends the source string to the destination string with respect of the |
28 * @param size size of the destination buffer |
28 * terminating null-character and the maximum size of the destination |
|
29 * buffer. |
|
30 * |
|
31 * @note usage ttd_strlcat(dst, src, lengthof(dst)); |
|
32 * |
|
33 * @param dst The buffer containing the target string |
|
34 * @param src The buffer containing the string to append |
|
35 * @param size The maximum size of the destination buffer |
29 */ |
36 */ |
30 void ttd_strlcat(char *dst, const char *src, size_t size); |
37 void ttd_strlcat(char *dst, const char *src, size_t size); |
|
38 |
|
39 /** |
|
40 * Copies characters from one buffer to another. |
|
41 * |
|
42 * Copies the source string to the destination buffer with respect of the |
|
43 * terminating null-character and the maximum size of the destination |
|
44 * buffer. |
|
45 * |
|
46 * @note usage ttd_strlcpy(dst, src, lengthof(dst)); |
|
47 * |
|
48 * @param dst The destination buffer |
|
49 * @param src The buffer containing the string to copy |
|
50 * @param size The maximum size of the destination buffer |
|
51 */ |
31 void ttd_strlcpy(char *dst, const char *src, size_t size); |
52 void ttd_strlcpy(char *dst, const char *src, size_t size); |
32 |
53 |
33 /** |
54 /** |
34 * usage: strecpy(dst, src, lastof(dst)); |
55 * Appends characters from one string to another. |
35 * @param dst destination buffer |
56 * |
36 * @param src string to copy |
57 * Appends the source string to the destination string with respect of the |
37 * @param last pointer to the last element in the dst array |
58 * terminating null-character and and the last pointer to the last element |
38 * if NULL no boundary check is performed |
59 * in the destination buffer. If the last pointer is set to NULL no |
39 * @return a pointer to the terminating \0 in the destination buffer |
60 * boundary check is performed. |
|
61 * |
|
62 * @note usage: strecat(dst, src, lastof(dst)); |
|
63 * |
|
64 * @param dst The buffer containing the target string |
|
65 * @param src The buffer containing the string to append |
|
66 * @param last The pointer to the last element of the destination buffer |
|
67 * @return The pointer to the terminating null-character in the destination buffer |
40 */ |
68 */ |
41 char *strecat(char *dst, const char *src, const char *last); |
69 char *strecat(char *dst, const char *src, const char *last); |
|
70 |
|
71 /** |
|
72 * Copies characters from one buffer to another. |
|
73 * |
|
74 * Copies the source string to the destination buffer with respect of the |
|
75 * terminating null-character and the last pointer to the last element in |
|
76 * the destination buffer. If the last pointer is set to NULL no boundary |
|
77 * check is performed. |
|
78 * |
|
79 * @note usage: strecpy(dst, src, lastof(dst)); |
|
80 * |
|
81 * @param dst The destination buffer |
|
82 * @param src The buffer containing the string to copy |
|
83 * @param last The pointer to the last element of the destination buffer |
|
84 * @return The pointer to the terminating null-character in the destination buffer |
|
85 */ |
42 char *strecpy(char *dst, const char *src, const char *last); |
86 char *strecpy(char *dst, const char *src, const char *last); |
43 |
87 |
44 int CDECL seprintf(char *str, const char *last, const char *format, ...); |
88 int CDECL seprintf(char *str, const char *last, const char *format, ...); |
45 |
89 |
46 char *CDECL str_fmt(const char *str, ...); |
90 char *CDECL str_fmt(const char *str, ...); |