summaryrefslogtreecommitdiff
path: root/src/user/lib/fwik/io
diff options
context:
space:
mode:
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));
}