Add BSD compatible strlcpy function (uc_strlcpy)

This commit is contained in:
Nils O. Selåsdal
2014-01-08 00:37:33 +01:00
parent 0e2d4f07c3
commit 3e313932af
2 changed files with 29 additions and 0 deletions
+12
View File
@@ -101,6 +101,18 @@ char * uc_human_bytesz_dec(uint64_t bytes, char *result, size_t result_len);
//(base 2 ,1 KiB == 1024 bytes)
char * uc_human_bytesz_bin(uint64_t bytes, char *result, size_t result_len);
/** Copy a C string ensuring dst is nul terminated.
* If @max is 0, no action is done
* src must be a nul terminated string
*
* @param dst destination buffer
* @param src source string
* @maram max max chars (including nul terminator to copy). This should
* is normally the size of the dst buffer)
* return strlen(src) which may be larger than the no. of bytes copied.
*/
size_t uc_strlcpy(char *dst, const char *src, size_t max);
#ifdef __cplusplus
}
#endif