summaryrefslogtreecommitdiff
path: root/src/user/lib/fwik/io
diff options
context:
space:
mode:
authorAlex AUVOLAT <alexis211@gmail.com>2012-05-19 14:07:01 +0200
committerAlex AUVOLAT <alexis211@gmail.com>2012-05-19 14:07:01 +0200
commit0d2f7645c3fb45d83497faf2a4b6fff8c3f175d1 (patch)
treea9038fce4cf81556fbdd5589caee8f4e9bfc5185 /src/user/lib/fwik/io
parent499ca6c243b05da176a2d4bd9a2317f0b28afc7f (diff)
downloadTCE-0d2f7645c3fb45d83497faf2a4b6fff8c3f175d1.tar.gz
TCE-0d2f7645c3fb45d83497faf2a4b6fff8c3f175d1.zip
Added string class for FWIK.
Diffstat (limited to 'src/user/lib/fwik/io')
-rw-r--r--src/user/lib/fwik/io/IOStream.cpp4
-rw-r--r--src/user/lib/fwik/io/Term.cpp11
2 files changed, 9 insertions, 6 deletions
diff --git a/src/user/lib/fwik/io/IOStream.cpp b/src/user/lib/fwik/io/IOStream.cpp
index bcaa581..ae495c0 100644
--- a/src/user/lib/fwik/io/IOStream.cpp
+++ b/src/user/lib/fwik/io/IOStream.cpp
@@ -13,7 +13,7 @@ void IOStream::printf(char* fmt, ...) {
va_end(ap);
}
-char* IOStream::readln() {
- if (term == 0) return 0;
+String IOStream::readln() {
+ if (term == 0) return "";
return term->readln();
}
diff --git a/src/user/lib/fwik/io/Term.cpp b/src/user/lib/fwik/io/Term.cpp
index 1c6db66..f7f28ec 100644
--- a/src/user/lib/fwik/io/Term.cpp
+++ b/src/user/lib/fwik/io/Term.cpp
@@ -42,10 +42,13 @@ void Term::vprintf(char* fmt, va_list ap) {
libc::vfprintf(fd, fmt, ap);
}
-char* Term::readln() {
- return libc::freadln(fd);
+String Term::readln() {
+ char *s = libc::freadln(fd);
+ String ret(s);
+ free(s);
+ return ret;
}
-char *Term::readline() {
- return libc::freadline(fd, &hist);
+String Term::readline() {
+ return String(libc::freadline(fd, &hist));
}