diff options
author | Alexis211 <alexis211@gmail.com> | 2009-09-19 19:21:28 +0200 |
---|---|---|
committer | Alexis211 <alexis211@gmail.com> | 2009-09-19 19:21:28 +0200 |
commit | 64fc3862f602750733b7dc0447d22ae5d4146821 (patch) | |
tree | 19d5a575c72744c75670543cdaedb1dce176a145 /Source/Kernel/Core/kmain.wtf.cpp | |
parent | 435b36921c10fecc363a61010e35cc8e508425dc (diff) | |
download | Melon-64fc3862f602750733b7dc0447d22ae5d4146821.tar.gz Melon-64fc3862f602750733b7dc0447d22ae5d4146821.zip |
Implemented ByteArray and wf command.
Diffstat (limited to 'Source/Kernel/Core/kmain.wtf.cpp')
-rw-r--r-- | Source/Kernel/Core/kmain.wtf.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
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 <TaskManager/Task.ns.h> #include <SyscallManager/IDT.ns.h> #include <Library/String.class.h> +#include <Library/ByteArray.class.h> #include <VFS/Part.ns.h> #include <FileSystems/RamFS/RamFS.class.h> #include <VFS/FileNode.class.h> @@ -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<Device*> dev = Dev::findDevices(); *kvt << " - Detected devices :\n"; |