aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/lib/string.c
diff options
context:
space:
mode:
authorMarvin Borner2019-09-25 22:57:33 +0200
committerMarvin Borner2019-09-25 22:57:33 +0200
commit8ebf584bbb43584b671b79d5166e00268a7c9661 (patch)
tree466abea4e6da201e7b432d7394e1bf21cbbe1d98 /src/kernel/lib/string.c
parent16b8a48d1de16a5982cf983a282832fd4ed01f85 (diff)
Fixed several TTY bugs and improved VESA detection
Diffstat (limited to 'src/kernel/lib/string.c')
-rw-r--r--src/kernel/lib/string.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/kernel/lib/string.c b/src/kernel/lib/string.c
index 6ef0316..2b8cdfb 100644
--- a/src/kernel/lib/string.c
+++ b/src/kernel/lib/string.c
@@ -25,3 +25,32 @@ char *strcat(char *dst, const char *src) {
dst[i + j] = 0;
return dst;
}
+
+char *strcpy(char *dst, const char *src) {
+ unsigned int i = 0;
+ for (i = 0; src[i] != 0; i++) {
+ dst[i] = src[i];
+ }
+ dst[i] = 0;
+ return dst;
+}
+
+char *itoa(int i, char b[]) {
+ char const digit[] = "0123456789";
+ char *p = b;
+ if (i < 0) {
+ *p++ = '-';
+ i *= -1;
+ }
+ int shifter = i;
+ do {
+ ++p;
+ shifter = shifter / 10;
+ } while (shifter);
+ *p = '\0';
+ do {
+ *--p = digit[i % 10];
+ i = i / 10;
+ } while (i);
+ return b;
+} \ No newline at end of file