Portability wrapper that calls strlcpy() on systems which have it,
and emulates strlcpy() otherwise. Copies src to dest; dest is
guaranteed to be nul-terminated; src must be nul-terminated;
dest_size is the buffer size, not the number of chars to copy.
At most dest_size - 1 characters will be copied. Always nul-terminates
(unless dest_size == 0). This function does not
allocate memory. Unlike strncpy(), this function doesn't pad dest (so
it's often faster). It returns the size of the attempted result,
strlen (src), so if retval >= dest_size, truncation occurred.
Note
Caveat: strlcpy() is supposedly more secure than
strcpy() or strncpy(), but if you really want to avoid screwups,
g_strdup() is an even better idea.
Portability wrapper that calls strlcpy() on systems which have it, and emulates strlcpy() otherwise. Copies src to dest; dest is guaranteed to be nul-terminated; src must be nul-terminated; dest_size is the buffer size, not the number of chars to copy. At most dest_size - 1 characters will be copied. Always nul-terminates (unless dest_size == 0). This function does not allocate memory. Unlike strncpy(), this function doesn't pad dest (so it's often faster). It returns the size of the attempted result, strlen (src), so if retval >= dest_size, truncation occurred. Note Caveat: strlcpy() is supposedly more secure than strcpy() or strncpy(), but if you really want to avoid screwups, g_strdup() is an even better idea.