summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-07-16 09:29:52 +0000
committerJim Meyering <jim@meyering.net>2002-07-16 09:29:52 +0000
commit6978ba6736e6b45c8f14b6ed75f298aa3da4830d (patch)
treec6d1e3a60a2237fb92d76a59e3482b0ba84f71e8
parent753bb04a601b68ab4ca86a64897be81956bfb207 (diff)
downloadcoreutils-6978ba6736e6b45c8f14b6ed75f298aa3da4830d.tar.xz
(print_it): Use memcpy and a little pointer arithmetic, rather than stpncpy.
-rw-r--r--src/stat.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/stat.c b/src/stat.c
index 8b42fe9d3..6939df00f 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -610,15 +610,14 @@ print_it (char const *masterformat, char const *filename,
char *p = strchr (b, '%');
if (p != NULL)
{
- char *d;
size_t len;
*p++ = '\0';
fputs (b, stdout);
len = strspn (p, "#-+.I 0123456789");
dest[0] = '%';
- d = stpncpy (dest + 1, p, len);
- *d = 0;
+ memcpy (dest + 1, p, len);
+ dest[1 + len] = 0;
p += len;
switch (*p)