summaryrefslogtreecommitdiff
path: root/Source/Library/Userland
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-12-20 16:13:44 +0100
committerAlexis211 <alexis211@gmail.com>2009-12-20 16:13:44 +0100
commit2d3c5a9c47d99c8f4f5561f9eae16497c1cde63a (patch)
treea3f800e17a34a16a00b6dc0b980e2f6cfed22dd5 /Source/Library/Userland
parentcab353cbb21c142ac1e227d42338fa587e1a7f24 (diff)
downloadMelon-2d3c5a9c47d99c8f4f5561f9eae16497c1cde63a.tar.gz
Melon-2d3c5a9c47d99c8f4f5561f9eae16497c1cde63a.zip
Added file streams and string streams
Diffstat (limited to 'Source/Library/Userland')
-rw-r--r--Source/Library/Userland/App/ShellApp.proto.cpp4
-rw-r--r--Source/Library/Userland/App/ShellApp.proto.h1
-rw-r--r--Source/Library/Userland/Binding/VirtualTerminal.class.h13
3 files changed, 16 insertions, 2 deletions
diff --git a/Source/Library/Userland/App/ShellApp.proto.cpp b/Source/Library/Userland/App/ShellApp.proto.cpp
index f2233bc..9528ca2 100644
--- a/Source/Library/Userland/App/ShellApp.proto.cpp
+++ b/Source/Library/Userland/App/ShellApp.proto.cpp
@@ -9,6 +9,10 @@ ShellApp::ShellApp(String name, String desc)
addFlag("h", "help", "Show this help screen");
}
+ShellApp::~ShellApp() {
+ outvt << END;
+}
+
void ShellApp::init() {
//Parse flags
u32int argc = pr.argc();
diff --git a/Source/Library/Userland/App/ShellApp.proto.h b/Source/Library/Userland/App/ShellApp.proto.h
index 5575112..2308fd1 100644
--- a/Source/Library/Userland/App/ShellApp.proto.h
+++ b/Source/Library/Userland/App/ShellApp.proto.h
@@ -24,6 +24,7 @@ class ShellApp : public Application {
Vector<flag_t> flags;
String appName, appDesc;
ShellApp(String name, String desc);
+ ~ShellApp();
virtual void init();
diff --git a/Source/Library/Userland/Binding/VirtualTerminal.class.h b/Source/Library/Userland/Binding/VirtualTerminal.class.h
index 6576c1c..54bdc53 100644
--- a/Source/Library/Userland/Binding/VirtualTerminal.class.h
+++ b/Source/Library/Userland/Binding/VirtualTerminal.class.h
@@ -11,6 +11,9 @@
#include <WChar.class.h>
class VirtualTerminal : public RessourceCaller, public OStream, public IStream {
+ private:
+ bool m_eof;
+
public:
static VirtualTerminal getIn() {
u32int id = RessourceCaller::sCall(VTIF_OBJTYPE, VTIF_SGETPRINVT);
@@ -20,7 +23,7 @@ class VirtualTerminal : public RessourceCaller, public OStream, public IStream {
u32int id = RessourceCaller::sCall(VTIF_OBJTYPE, VTIF_SGETPROUTVT);
return VirtualTerminal(id);
}
- VirtualTerminal(u32int id) : RessourceCaller(id, VTIF_OBJTYPE) {}
+ VirtualTerminal(u32int id) : RessourceCaller(id, VTIF_OBJTYPE) { m_eof = false; }
/*void writeHex(u32int number) {
doCall(VTIF_WRITEHEX, number);
@@ -32,7 +35,13 @@ class VirtualTerminal : public RessourceCaller, public OStream, public IStream {
doCall(VTIF_WRITE, (u32int)&s);
}
String read() {
- return String::unserialize(doCall(VTIF_READLINE, 1)) += "\n";
+ if (m_eof) return "";
+ String ret = String::unserialize(doCall(VTIF_READLINE, 1));
+ if (ret[ret.size() - 1] == WChar(EOF)) {
+ ret = ret.substr(0, ret.size() - 1);
+ m_eof = true;
+ }
+ return ret += "\n";
}
keypress_t getKeypress(bool show = true, bool block = true) {
keypress_t* ptr = (keypress_t*)doCall(VTIF_GETKEYPRESS, (show ? 1 : 0) | (block ? 2 : 0));