aboutsummaryrefslogtreecommitdiff
path: root/src/lib/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/strings.c')
-rw-r--r--src/lib/strings.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/strings.c b/src/lib/strings.c
new file mode 100644
index 0000000..8f62391
--- /dev/null
+++ b/src/lib/strings.c
@@ -0,0 +1,20 @@
+#include "../lib/strings.h"
+
+unsigned long strlen(char* s) {
+ unsigned long len = 0;
+ while (s[len] != 0) {
+ len += 1;
+ }
+ return len;
+}
+
+unsigned char strcmp(char* a, char* b) {
+ unsigned long idx = 0;
+ while (a[idx] != 0 && b[idx] != 0) {
+ if (a[idx] != b[idx]) {
+ return 0;
+ }
+ idx += 1;
+ }
+ return a[idx] == b[idx];
+}