implemented SIGSEGV

This commit is contained in:
minjaesong
2021-04-23 15:19:20 +09:00
parent 04cafea3c5
commit 48fd10aeed
4 changed files with 29 additions and 8 deletions

View File

@@ -300,7 +300,7 @@ shell.coreutils = {
}
},
dir: function(args) {
var pathstr = (args[1] !== undefined) ? args[1] : "\\"+shell_pwd.join("\\");
var pathstr = (args[1] !== undefined) ? args[1] : shell.getPwdString();
// check if path is valid
var pathOpened = filesystem.open(CURRENT_DRIVE, pathstr, 'R');
@@ -309,6 +309,15 @@ shell.coreutils = {
var port = filesystem._toPorts(CURRENT_DRIVE)[0]
com.sendMessage(port, "LIST");
println(com.pullMessage(port));
},
cat: function(args) {
var pathstr = (args[1] !== undefined) ? args[1] : shell.getPwdString();
var pathOpened = filesystem.open(CURRENT_DRIVE, pathstr, 'R');
if (!pathOpened) { printerrln("File not found"); return; }
let contents = filesystem.readAll(CURRENT_DRIVE);
// TODO just print out what's there
print(contents);
}
};
shell.coreutils.chdir = shell.coreutils.cd;