From c07ebfa1e02d208ab12430e6791ea147bcfaf9c0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 7 Dec 2006 00:25:46 +0100 Subject: Imported from util-linux-2.11b tarball. --- lib/xstrncpy.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 lib/xstrncpy.c (limited to 'lib/xstrncpy.c') diff --git a/lib/xstrncpy.c b/lib/xstrncpy.c new file mode 100644 index 0000000000..cf4940971a --- /dev/null +++ b/lib/xstrncpy.c @@ -0,0 +1,9 @@ +/* NUL-terminated version of strncpy() */ +#include +#include "xstrncpy.h" + +void +xstrncpy(char *dest, const char *src, size_t n) { + strncpy(dest, src, n-1); + dest[n-1] = 0; +} -- cgit 1.2.3-korg