summaryrefslogtreecommitdiff
path: root/src/strops.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/strops.cpp')
-rw-r--r--src/strops.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/strops.cpp b/src/strops.cpp
new file mode 100644
index 0000000..42042cb
--- /dev/null
+++ b/src/strops.cpp
@@ -0,0 +1,18 @@
+#include <string.h>
+
+#include "strops.hpp"
+
+size_t strops_copy(char *dst, const char *src, size_t size)
+{
+ size_t srclen;
+ size --;
+ srclen = strlen(src);
+
+ if (srclen > size)
+ srclen = size;
+
+ memcpy(dst, src, srclen);
+ dst[srclen] = '\0';
+
+ return (srclen);
+} \ No newline at end of file