summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-09-02 18:54:57 +0200
committerMichal Idziorek <m.i@gmx.at>2014-09-02 18:54:57 +0200
commit1a3a3a20773a5664c653a8aebcd10d288962285b (patch)
tree8af03d6cc24613d105e9f0534d0fa95b2089b117 /lib
parent3cf50b41a40f6c2bd824549104015f6d2f6799c0 (diff)
Improved directory structure.
Diffstat (limited to 'lib')
-rw-r--r--lib/bool/bool.h6
-rw-r--r--lib/int/stdint.h3
-rw-r--r--lib/string/string.c15
3 files changed, 24 insertions, 0 deletions
diff --git a/lib/bool/bool.h b/lib/bool/bool.h
new file mode 100644
index 0000000..be2cbd4
--- /dev/null
+++ b/lib/bool/bool.h
@@ -0,0 +1,6 @@
+#include "lib/int/stdint.h"
+
+#define false 0
+#define true !false
+#define bool uint8_t
+
diff --git a/lib/int/stdint.h b/lib/int/stdint.h
new file mode 100644
index 0000000..38b7040
--- /dev/null
+++ b/lib/int/stdint.h
@@ -0,0 +1,3 @@
+#include <stdint.h>
+
+
diff --git a/lib/string/string.c b/lib/string/string.c
new file mode 100644
index 0000000..45d8ad1
--- /dev/null
+++ b/lib/string/string.c
@@ -0,0 +1,15 @@
+#include "lib/bool/bool.h"
+
+
+//length 0 for null terminated strings;
+bool strcmp(char *str1, char *str2, int length)
+{
+ int i=0;
+
+ while(true)
+ {
+ if(str1[i]!=str2[i])return false;
+ i++;
+ if(i==length||str1[i]==str2[i]==0) return true;
+ }
+}