2006-12-06 17:25:46 -06:00
|
|
|
/* NUL-terminated version of strncpy() */
|
|
|
|
#include <string.h>
|
|
|
|
#include "xstrncpy.h"
|
|
|
|
|
2006-12-06 17:25:49 -06:00
|
|
|
/* caller guarantees n > 0 */
|
2006-12-06 17:25:46 -06:00
|
|
|
void
|
|
|
|
xstrncpy(char *dest, const char *src, size_t n) {
|
|
|
|
strncpy(dest, src, n-1);
|
|
|
|
dest[n-1] = 0;
|
|
|
|
}
|