From d25429b738cb9c1b34d234ae23b3af27fdff72ea Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Sun, 13 Sep 2009 18:47:37 +0200 Subject: Changed welcome text and added a few error messages. --- Source/Kernel/Core/kmain.wtf.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'Source/Kernel/Core') diff --git a/Source/Kernel/Core/kmain.wtf.cpp b/Source/Kernel/Core/kmain.wtf.cpp index 808e254..59d74b5 100644 --- a/Source/Kernel/Core/kmain.wtf.cpp +++ b/Source/Kernel/Core/kmain.wtf.cpp @@ -164,14 +164,19 @@ void kmain(multiboot_info_t* mbd, u32int magic) { } } } else if (tokens[0] == "cd") { - FSNode* n = VFS::find(tokens[1], cwd); - if (n == NULL) - *kvt << "No such directory : " << tokens[1] << "\n"; - else if (n->type() != NT_DIRECTORY) - *kvt << "Not a directory : " << tokens[1] << "\n"; - else - cwd = (DirectoryNode*)n; + if (tokens.size() == 1) { + *kvt << "Where shall I take you, sir ?\n"; + } else { + FSNode* n = VFS::find(tokens[1], cwd); + if (n == NULL) + *kvt << "No such directory : " << tokens[1] << "\n"; + else if (n->type() != NT_DIRECTORY) + *kvt << "Not a directory : " << tokens[1] << "\n"; + else + cwd = (DirectoryNode*)n; + } } else if (tokens[0] == "cat") { + if (tokens.size() == 1) *kvt << "Meow.\n"; for (u32int i = 1; i < tokens.size(); i++) { FSNode* n = VFS::find(tokens[i], cwd); if (n == NULL) { @@ -180,8 +185,9 @@ void kmain(multiboot_info_t* mbd, u32int magic) { *kvt << "Not a file : " << tokens[1] << "\n"; } else { FileNode* f = (FileNode*) n; - u8int *buff = (u8int*)Mem::kalloc(f->getLength()); + u8int *buff = (u8int*)Mem::kalloc(f->getLength() + 1); f->read(0, f->getLength(), buff); + buff[f->getLength()] = 0; *kvt << String((const char*) buff); Mem::kfree(buff); } -- cgit v1.2.3