summaryrefslogtreecommitdiffhomepage
path: root/dev/libDDK/src/ddk_str.c
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-08-25 09:50:27 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-08-25 09:50:27 +0200
commita7939c9a20d5f4b83d5df34aa652a88a0764042c (patch)
treed773fa076011ac6a54c1de93755797b09e7bd3ca /dev/libDDK/src/ddk_str.c
parentd864e0c6281024ce4b9bd654aa83308a50f583d8 (diff)
feat! ddk -> libDDK, use syscall on AMD64.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/libDDK/src/ddk_str.c')
-rw-r--r--dev/libDDK/src/ddk_str.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/dev/libDDK/src/ddk_str.c b/dev/libDDK/src/ddk_str.c
new file mode 100644
index 00000000..514cddc7
--- /dev/null
+++ b/dev/libDDK/src/ddk_str.c
@@ -0,0 +1,34 @@
+/* -------------------------------------------
+
+ Copyright Amlal El Mahrouss.
+
+ Purpose: DDK String API.
+
+------------------------------------------- */
+
+#include <DriverKit/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;
+}