Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109802807
D42863.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1007 B
Referenced Files
None
Subscribers
None
D42863.diff
View Options
diff --git a/lib/libc/amd64/string/Makefile.inc b/lib/libc/amd64/string/Makefile.inc
--- a/lib/libc/amd64/string/Makefile.inc
+++ b/lib/libc/amd64/string/Makefile.inc
@@ -13,6 +13,7 @@
strcmp.S \
strcpy.c \
strcspn.S \
+ strlcat.c \
strlcpy.S \
strlen.S \
strncmp.S \
diff --git a/lib/libc/amd64/string/strlcat.c b/lib/libc/amd64/string/strlcat.c
new file mode 100644
--- /dev/null
+++ b/lib/libc/amd64/string/strlcat.c
@@ -0,0 +1,25 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2023 Robert Clausecker
+ */
+
+#include <sys/cdefs.h>
+
+#include <string.h>
+
+void *__memchr(const void *, int, size_t);
+size_t __strlcpy(char *restrict, const char *restrict, size_t);
+
+size_t
+strlcat(char *restrict dst, const char *restrict src, size_t dstsize)
+{
+ char *loc = __memchr(dst, '\0', dstsize);
+
+ if (loc != NULL) {
+ size_t dstlen = (size_t)(loc - dst);
+
+ return (dstlen + __strlcpy(loc, src, dstsize - dstlen));
+ } else
+ return (dstsize + strlen(src));
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 10, 5:59 PM (7 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16581315
Default Alt Text
D42863.diff (1007 B)
Attached To
Mode
D42863: lib/libc/amd64/string: add strlcpy scalar/baseline implementation
Attached
Detach File
Event Timeline
Log In to Comment