diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-19 16:38:56 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-05-19 16:38:56 +0200 |
commit | d502fce7d4db492690e39c72fc029aa05a65057d (patch) | |
tree | a5797a97212fff8142dc7f61792facca07c904eb /src/user/lib/fwik/io/Term.cpp | |
parent | 8e07c1db6ba4bedd0f8fe537a6fb0ca80e5d25f4 (diff) | |
download | TCE-d502fce7d4db492690e39c72fc029aa05a65057d.tar.gz TCE-d502fce7d4db492690e39c72fc029aa05a65057d.zip |
More improvements in FWIK - more strings, Dir class, ...
Diffstat (limited to 'src/user/lib/fwik/io/Term.cpp')
-rw-r--r-- | src/user/lib/fwik/io/Term.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/user/lib/fwik/io/Term.cpp b/src/user/lib/fwik/io/Term.cpp index 1540b9a..f8f686e 100644 --- a/src/user/lib/fwik/io/Term.cpp +++ b/src/user/lib/fwik/io/Term.cpp @@ -6,25 +6,33 @@ Term::Term(const Node &n) : Node(n) { 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 { - valid = false; + error = E_INVALID_TYPE; } hist.str = 0; hist.max = 12; } Term::~Term() { - //TODO : free readline history + 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) { |