diff options
| author | Jake Mannens <jake72360@gmail.com> | 2018-06-17 06:13:33 +1000 |
|---|---|---|
| committer | Jake Mannens <jake72360@gmail.com> | 2018-06-17 06:13:33 +1000 |
| commit | dc862c6346ac0d762d98cee9bcb5ed09dd5e3066 (patch) | |
| tree | 7a329d2c77f5d8ea9ee67c607fadd117d2efa788 | |
| parent | 6a6f31db520177d15a604ebd77ec68b7fc94dce6 (diff) | |
Cleaned up console I/O functions in con.c and con.h respectively.
| -rw-r--r-- | include/kernel/con.h | 5 | ||||
| -rw-r--r-- | kernel/con.c | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/include/kernel/con.h b/include/kernel/con.h index 4e564ed..bdfefa0 100644 --- a/include/kernel/con.h +++ b/include/kernel/con.h @@ -1,7 +1,7 @@ /* * con.h * - * Basic VGA text console + * Basic VGA text console. Implements printf() and puts(). */ #ifndef _CON_H @@ -9,6 +9,7 @@ void con_init(void); -void con_print(char*); +int puts(char *s); +int printf(char*, ...); #endif diff --git a/kernel/con.c b/kernel/con.c index b3d2b9d..3b48de1 100644 --- a/kernel/con.c +++ b/kernel/con.c @@ -1,7 +1,7 @@ /* * con.c * - * Basic VGA text console + * Basic VGA text console. Implements printf() and puts(). */ #include <asm/io.h> @@ -58,7 +58,7 @@ void con_init(void) { } /* write a zero-terminated string to console */ -void con_print(char *s) { +int puts(char *s) { uint8_t *p = &vram[pos]; while(*s) { @@ -80,6 +80,9 @@ void con_print(char *s) { /* update the cursor position */ cursorpos(pos); + + /* this always succeeds */ + return 0; } int printf(char *fmt, ...) { @@ -91,6 +94,6 @@ int printf(char *fmt, ...) { ret = vsprintf(buf, fmt, ap); va_end(ap); - con_print(buf); + puts(buf); return ret; } |
