From 5dd48c50c0cf7793a5dafa6be769c8a3f8b9ab60 Mon Sep 17 00:00:00 2001 From: Alexis211 Date: Fri, 23 Oct 2009 21:06:23 +0200 Subject: Added some screenshots (\o/) and implemented mkdir in userland. --- Source/Applications/Shell/Shell-fs.ns.cpp | 14 ++++++++++++++ Source/Applications/Shell/Shell.ns.cpp | 1 + Source/Applications/Shell/Shell.ns.h | 1 + 3 files changed, 16 insertions(+) (limited to 'Source/Applications/Shell') diff --git a/Source/Applications/Shell/Shell-fs.ns.cpp b/Source/Applications/Shell/Shell-fs.ns.cpp index 5e6ae4f..b7e585a 100644 --- a/Source/Applications/Shell/Shell-fs.ns.cpp +++ b/Source/Applications/Shell/Shell-fs.ns.cpp @@ -15,8 +15,13 @@ void ls(Vector& args) { d = n; } if (d.valid()) outvt << "Contents of directory " << d.path() << " :\n"; + if (!d.valid()) return; for (u32int i = 0; i < d.getLength(); i++) { FSNode n = d.getChild(i); + if (!n.valid()) { + outvt << " [inacessible file]\n"; //This is a file we are not supposed to be able to read + continue; + } String perm = "rwxrwxrwx"; u32int p = n.getPerm(); for (u32int i = 0; i < 9; i++) { @@ -63,4 +68,13 @@ void rm(Vector& args) { } } +void mkdir(Vector& args) { + if (args.size() == 1) outvt << "No directory to create.\n"; + for (u32int i = 1; i < args.size(); i++) { + if (!FS::mkdir(args[i], cwd).valid()) { + outvt << "Error while creating directory " << args[i] << "\n"; + } + } +} + } diff --git a/Source/Applications/Shell/Shell.ns.cpp b/Source/Applications/Shell/Shell.ns.cpp index 1f8acae..fe8c5f9 100644 --- a/Source/Applications/Shell/Shell.ns.cpp +++ b/Source/Applications/Shell/Shell.ns.cpp @@ -15,6 +15,7 @@ u32int run() { {"cd", cd}, {"pwd", pwd}, {"rm", rm}, + {"mkdir", mkdir}, {"", 0} }; diff --git a/Source/Applications/Shell/Shell.ns.h b/Source/Applications/Shell/Shell.ns.h index 5cf4509..56fdb46 100644 --- a/Source/Applications/Shell/Shell.ns.h +++ b/Source/Applications/Shell/Shell.ns.h @@ -11,4 +11,5 @@ namespace Shell { extern void cd(Vector& args); extern void pwd(Vector& args); extern void rm(Vector& args); + extern void mkdir(Vector& args); } -- cgit v1.2.3