diff options
| author | Karel Zak <kzak@redhat.com> | 2006-12-07 00:25:46 +0100 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2006-12-07 00:25:46 +0100 |
| commit | c07ebfa1e02d208ab12430e6791ea147bcfaf9c0 (patch) | |
| tree | d44a755098286f5d553c7aea1a73d98c2995d6ec /lib/xstrncpy.c | |
| parent | 66ee8158b69525e12060ef558cb5d77feadab1dc (diff) | |
| download | util-linux-c07ebfa1e02d208ab12430e6791ea147bcfaf9c0.tar.gz | |
Imported from util-linux-2.11b tarball.v2.11b
Diffstat (limited to 'lib/xstrncpy.c')
| -rw-r--r-- | lib/xstrncpy.c | 9 |
1 files changed, 9 insertions, 0 deletions
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 <string.h> +#include "xstrncpy.h" + +void +xstrncpy(char *dest, const char *src, size_t n) { + strncpy(dest, src, n-1); + dest[n-1] = 0; +} |
