summaryrefslogtreecommitdiffhomepage
path: root/dev/ddk/src/ddk_str.c
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-03-27 17:24:21 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-03-27 17:24:21 +0100
commitb8f7ef086d1d1b1cd686fff04d0a587f8fd39d81 (patch)
treeb6c2eb3ca2c51dc87ddd81b6170d5f63eabb9090 /dev/ddk/src/ddk_str.c
parenteb86df50ec5afb392998e2e171de54e1f26d8e7a (diff)
add: new driver device kit API. (DDK)
refactor: rename SCIKit -> user (then libuser.dylib) boot/modules/netboot: fixed compilation for amd64. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/ddk/src/ddk_str.c')
-rw-r--r--dev/ddk/src/ddk_str.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/dev/ddk/src/ddk_str.c b/dev/ddk/src/ddk_str.c
new file mode 100644
index 00000000..1558e636
--- /dev/null
+++ b/dev/ddk/src/ddk_str.c
@@ -0,0 +1,40 @@
+/* -------------------------------------------
+
+ Copyright Amlal EL Mahrouss.
+
+ Purpose: DDK Strings.
+
+------------------------------------------- */
+
+#include <ddk/str.h>
+
+DDK_EXTERN size_t kstrlen(const char* in)
+{
+ if (in == nil)
+ return 0;
+
+ if (*in == 0)
+ return 0;
+
+ size_t index = 0;
+
+ while (in[index] != 0)
+ {
+ ++index;
+ }
+
+ return index;
+}
+
+DDK_EXTERN int kstrncpy(char* dst, const char* src, size_t len)
+{
+ size_t index = 0;
+
+ while (index != len)
+ {
+ dst[index] = src[index];
+ ++index;
+ }
+
+ return index;
+}