libgslutil
1.2.3
|
Functions | |
size_t | safe_strlcpy (char *dest, const char *src, size_t dest_size) |
Copy source to destination, limit by length. More... | |
size_t | safe_strlcat (char *dest, const char *src, size_t dest_size) |
Catenate source onto destination, limit by length. More... | |
An implementation of strlcpy() and strlcat().
size_t safe_strlcpy | ( | char * | dest, |
const char * | src, | ||
size_t | dest_size | ||
) |
Copy source to destination, limit by length.
dest | Pointer to destination buffer. |
src | Pointer to source string. |
dest_size | Size of destination buffer in bytes. |
Like strcpy(3)
except it will never write more than dest_size bytes to dest (i.e. the result is truncated if it would not fit) and as long as dest_size is not zero then dest will always be null terminated.
size_t safe_strlcat | ( | char * | dest, |
const char * | src, | ||
size_t | dest_size | ||
) |
Catenate source onto destination, limit by length.
dest | Pointer to destination buffer. |
src | Pointer to source string. |
dest_size | Size of destination buffer in bytes. |
Like strcat(3)
except it will never write more than dest_size bytes to dest (i.e. the result is truncated if it would not fit) and as long as dest_size is not zero then dest will always be null terminated.