diff options
Diffstat (limited to 'src/user/lib/fwik/io/Term.cpp')
-rw-r--r-- | src/user/lib/fwik/io/Term.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/user/lib/fwik/io/Term.cpp b/src/user/lib/fwik/io/Term.cpp deleted file mode 100644 index f8f686e..0000000 --- a/src/user/lib/fwik/io/Term.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include <IO/Term.h> - -Term::Term(const Node &n) : Node(n) { - _init(); -} - -Term::Term(FILE f) : Node(f) { - _init(); - if (error E_INVALID_TYPE) libc::close(fd); -} - -Term::Term(const char* filename, int mode) : Node(filename, mode) { - _init(); - if (error == E_INVALID_TYPE) libc::close(fd); -} - -void Term::_init() { - if (error < 0) return; - if (info.type & FT_TERMINAL) { - w = info.size >> 16; - h = info.size & 0xFFFF; - } else { - error = E_INVALID_TYPE; - } - hist.str = 0; - hist.max = 12; -} - -Term::~Term() { - if (hist.str != 0) { - for (int i = 0; i < hist.max; i++) { - if (hist.str[i] != 0) free(hist.str[i]); - } - free(hist.str); - } -} - -void Term::print(const char *s) { - libc::fprint(fd, s); -} - -void Term::printf(const char* fmt, ...) { - va_list ap; - va_start(ap, fmt); - libc::vfprintf(fd, fmt, ap); - va_end(ap); -} - -void Term::vprintf(const char* fmt, va_list ap) { - libc::vfprintf(fd, fmt, ap); -} - -String Term::readln() { - char *s = libc::freadln(fd); - String ret(s); - free(s); - return ret; -} - -String Term::readline() { - return String(libc::freadline(fd, &hist)); -} |