mirror of
https://github.com/ericonr/util-linux.git
synced 2024-04-21 09:12:35 -05:00
11 lines
214 B
C
11 lines
214 B
C
/* NUL-terminated version of strncpy() */
|
|
#include <string.h>
|
|
#include "xstrncpy.h"
|
|
|
|
/* caller guarantees n > 0 */
|
|
void
|
|
xstrncpy(char *dest, const char *src, size_t n) {
|
|
strncpy(dest, src, n-1);
|
|
dest[n-1] = 0;
|
|
}
|