From 64fc3862f602750733b7dc0447d22ae5d4146821 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sat, 19 Sep 2009 19:21:28 +0200 Subject: Implemented ByteArray and wf command. --- Source/Kernel/Core/kmain.wtf.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Source/Kernel/Core') diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index e263393..11fbbea 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -211,7 +212,23 @@ void kmain(multiboot_info_t* mbd, u32int magic) { *kvt << "No argument specified.\n"; } } else if (tokens[0] == "wf") { - *kvt << "Sorry, this command isn't implemented yet.\n"; + //*kvt << "Sorry, this command isn't implemented yet.\n"; + if (tokens.size() == 1) { + *kvt << "No file to write !\n"; + } else { + File f(tokens[1], FM_TRUNCATE, cwd); + if (f.valid()) { + String t = kvt->readLine(); + while (t != ".") { + t += "\n"; + ByteArray temp(t); + f.write(temp); + t = kvt->readLine(); + } + } else { + *kvt << "Error openning file.\n"; + } + } } else if (tokens[0] == "devices") { Vector dev = Dev::findDevices(); *kvt << " - Detected devices :\n"; -- cgit v1.2.3