#include "libut/ut.h" char* UT_strncpy(char *dst, char *src, size_t n);
This is a safer, NUL-terminating version of strncpy(3). It copies the src string to dst up to n bytes, making the last byte NUL.
The defect of strncpy(3)
is that it does not NUL-terminate the destination
string dst when the src string (without its NUL-terminator) is of length
n bytes or longer. This function NUL-terminates the dst string at the
n-th byte instead.
The dst pointer is returned.
An equivalent function called strlcpy is available on some platforms.
Troy D. Hanson <thanson@users.sourceforge.net>