aboutsummaryrefslogtreecommitdiff
path: root/src/userspace/mlibc/stdio
diff options
context:
space:
mode:
authorMarvin Borner2019-12-21 22:22:03 +0100
committerMarvin Borner2019-12-21 22:22:03 +0100
commit499784a824c541001c2fd52ae95eba88dcfc952b (patch)
treec3c26d7c8a3b9291d909f4655b7d27a5ae2369bc /src/userspace/mlibc/stdio
parent38610cd06dc0b5a3a4ee46f5fe7c341191aa2bc1 (diff)
Many debugging/serial improvements
Sorry for the little information, but I did many things :)
Diffstat (limited to 'src/userspace/mlibc/stdio')
-rw-r--r--src/userspace/mlibc/stdio/readline.c6
-rw-r--r--src/userspace/mlibc/stdio/vprintf.c8
2 files changed, 6 insertions, 8 deletions
diff --git a/src/userspace/mlibc/stdio/readline.c b/src/userspace/mlibc/stdio/readline.c
index 91b5da0..8937702 100644
--- a/src/userspace/mlibc/stdio/readline.c
+++ b/src/userspace/mlibc/stdio/readline.c
@@ -1,16 +1,14 @@
-#include <syscall.h>
-#include <mlibc/string.h>
+#include <mlibc/stdlib.h>
#include <mlibc/stdio.h>
char *readline()
{
- char *ret = "";
+ char ret[256] = {'\0'};
char buf = 0;
while (buf != '\n') {
buf = getch();
writec(buf);
strcpy(ret, &buf);
}
- strcpy(ret, &buf);
return ret;
} \ No newline at end of file
diff --git a/src/userspace/mlibc/stdio/vprintf.c b/src/userspace/mlibc/stdio/vprintf.c
index 1d43c77..2536b79 100644
--- a/src/userspace/mlibc/stdio/vprintf.c
+++ b/src/userspace/mlibc/stdio/vprintf.c
@@ -3,7 +3,7 @@
#include <mlibc/stdio.h>
#include <mlibc/stdlib.h>
-void __writes(const char *data)
+void _writes(const char *data)
{
for (size_t i = 0; i < strlen(data); i++) writec(data[i]);
}
@@ -25,16 +25,16 @@ void vprintf(const char *fmt, va_list args)
buff = *fmt;
if (buff == 's') {
const char *str = va_arg(args, const char*);
- __writes(str);
+ _writes(str);
readyToFormat = 0;
} else if (buff == 'x') {
char *p = htoa((uint32_t) va_arg(args, int));
- __writes(p);
+ _writes(p);
free(p);
readyToFormat = 0;
} else if (buff == 'd') {
char *p = itoa(va_arg(args, int));
- __writes(p);
+ _writes(p);
free(p);
readyToFormat = 0;
} else if (buff == 'c') {