aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-28 17:35:10 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-28 17:35:10 -0400
commit34300ba37a9b82e51a602459956da1e6661a358c (patch)
treeed1b7cfe50a368fafcab7ef47a5c02eab1eab296
parenta8fa8cf1ce7cc61f4857c0a0555419f11170e6f0 (diff)
Add strlcpy for mac
-rw-r--r--src/stdlib/paths.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/stdlib/paths.c b/src/stdlib/paths.c
index 7f881c00..2cd87847 100644
--- a/src/stdlib/paths.c
+++ b/src/stdlib/paths.c
@@ -521,6 +521,18 @@ public Array_t Path$subdirectories(Path_t path, bool include_hidden)
return _filtered_children(path, include_hidden, S_IFDIR);
}
+#ifdef __APPLE__
+static size_t strlcpy(char *dst, const char *src, size_t size) {
+ size_t srclen = strlen(src);
+ if (size > 0) {
+ size_t copylen = (srclen >= size) ? size - 1 : srclen;
+ memcpy(dst, src, copylen);
+ dst[copylen] = '\0';
+ }
+ return srclen;
+}
+#endif
+
public Path_t Path$unique_directory(Path_t path)
{
path = Path$expand_home(path);