aboutsummaryrefslogtreecommitdiff
path: root/libbb/platform.c
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2021-03-09 08:43:43 +0300
committerCem Keylan <cem@ckyln.com>2021-03-09 08:43:43 +0300
commit7ccc9c2432a847b85da5f445977d09f014cbc75b (patch)
tree8067d45ebeea60f1ddaa8167cb1398e2b6631473 /libbb/platform.c
parentfef526c380e35cbdc0bdb8375487756c42659a75 (diff)
parent307cd26e9893ed0cf6ee88e7fca2d61d3da0e139 (diff)
downloadbusybox-master.tar.gz
Merge remote-tracking branch 'upstream/master'HEADmaster
Diffstat (limited to 'libbb/platform.c')
-rw-r--r--libbb/platform.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libbb/platform.c b/libbb/platform.c
index 329b0237e..7913353e2 100644
--- a/libbb/platform.c
+++ b/libbb/platform.c
@@ -166,6 +166,18 @@ char* FAST_FUNC stpcpy(char *p, const char *to_add)
}
#endif
+#ifndef HAVE_STPNCPY
+char* FAST_FUNC stpncpy(char *p, const char *to_add, size_t n)
+{
+ while (n != 0 && (*p = *to_add) != '\0') {
+ p++;
+ to_add++;
+ n--;
+ }
+ return p;
+}
+#endif
+
#ifndef HAVE_GETLINE
ssize_t FAST_FUNC getline(char **lineptr, size_t *n, FILE *stream)
{