summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJake Mannens <jake72360@gmail.com>2018-07-25 17:18:18 +1000
committerJake Mannens <jake72360@gmail.com>2018-07-25 17:18:18 +1000
commit9400716f56057d9f2fcd7f7ad033dfcb131105a2 (patch)
treeaf0e8a7fecf0231e8bd77e7470ad0d934b519778 /lib
parent45819c035d0b92275de68e559f066cbe50996926 (diff)
Added missing prototype for puts() in stdio.h.
Implemented a basic serial interface using COM0 which can be accessed with the system call sys_puts as well as the library functions rsputs() and rsprintf(). Renamed puts() in con.c to con_puts() and made the function static to avoid interference with the library function puts().
Diffstat (limited to 'lib')
-rw-r--r--lib/stdio.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/stdio.c b/lib/stdio.c
index 912fd17..a718ee4 100644
--- a/lib/stdio.c
+++ b/lib/stdio.c
@@ -3,6 +3,7 @@
#include <unistd.h>
_syscall1(int, puts, char*, s);
+_syscall1(int, rsputs, char*, s);
int printf(char *fmt, ...) {
int ret;
@@ -16,3 +17,16 @@ int printf(char *fmt, ...) {
puts(buf);
return ret;
}
+
+int rsprintf(char *fmt, ...) {
+ int ret;
+ char buf[1024];
+ va_list ap;
+
+ va_start(ap, fmt);
+ ret = vsprintf(buf, fmt, ap);
+ va_end(ap);
+
+ rsputs(buf);
+ return ret;
+}