diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2014-08-16 20:20:09 -0700 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2014-08-16 20:23:39 -0700 |
commit | 714de30ec82e570c89e0b0f32e36386d13b673a8 (patch) | |
tree | 6780a830cda38686c3dc7a7c4ba1bdd828a6064a /tty.c | |
parent | 86170ce65a9239abf33c1ca094aefdab065df53b (diff) |
Refactor into tty_printf
Diffstat (limited to 'tty.c')
-rw-r--r-- | tty.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -2,6 +2,7 @@ #include <unistd.h> #include <fcntl.h> #include <stdlib.h> +#include <stdarg.h> #include "tty.h" @@ -39,7 +40,7 @@ char tty_getchar(tty_t *tty){ } static void tty_sgr(tty_t *tty, int code){ - fprintf(tty->fout, "%c%c%im", 0x1b, '[', code); + tty_printf(tty, "%c%c%im", 0x1b, '[', code); } void tty_setfg(tty_t *tty, int fg){ @@ -58,3 +59,10 @@ void tty_setnormal(tty_t *tty){ tty->fgcolor = 9; } +void tty_printf(tty_t *tty, const char *fmt, ...){ + va_list args; + va_start(args, fmt); + vfprintf(tty->fout, fmt, args); + va_end(args); +} + |