Compare commits

..

No commits in common. "7fa61e115e1a5d4935ec77310a91d262d00e8a21" and "265681c61c6c45fef2419aeaf854d4ade47b1ce9" have entirely different histories.

4 changed files with 18 additions and 6 deletions

View File

@ -163,10 +163,10 @@ function ed.visual(buffer)
if cx ~= ox or cy ~= oy or force then
io.write("\27[2J\27[H")
for i = cy, cy+my do
io.write(string.format("\27[1;%iH\27[31m%4i \27[0m%s",(i-cy+1),i,(buffer[i] or "\27[36m~"):sub(cx,cx+mx-6)))
print(string.format("\27[31m%4i \27[0m%s",i,(buffer[i] or "\27[36m~"):sub(cx,cx+mx-6)))
end
elseif mode == "i" then
io.write(string.format("\27[2K\27[999D\27[31m%4i \27[0m%s",buffer.y,(buffer[buffer.y] or "\27[36m~"):sub(cx,cx+mx-6)))
print(string.format("\27[2K\27[999D\27[31m%4i \27[0m%s",buffer.y,(buffer[buffer.y] or "\27[36m~"):sub(cx,cx+mx-6)))
end
io.write(string.format("\27[1;%iH\27[0;36;%im\27[2K[%s] ced visual: %i,%i/%i, %iK free %i",my+2,(mode == "c" and 7) or 0, mode, buffer.x, buffer.y, #buffer, computer.freeMemory()//1024,mult))
io.write(string.format("\27[%i;%iH\27[0m",buffer.x+6-cx,buffer.y-cy+1))

View File

@ -38,7 +38,7 @@ function shell.interactive()
if not f then
print("\27[31m"..r)
else
local rt = {xpcall(f,debug.traceback)}
local rt = {pcall(f)}
local rs = table.remove(rt,1)
if not rs then io.write("\27[31m") end
for k,v in pairs(rt) do

View File

@ -83,7 +83,7 @@ function shutil.df() -- Prints free disk space.
local fstr = "%-"..tostring(ml).."s %5s %5s"
print("fs"..(" "):rep(ml-2).." size used")
for k,v in pairs(mt) do
local st, su = fs.spaceTotal("/"..v), fs.spaceUsed("/"..v)
local st, su = fs.spaceTotal(v.."/."), fs.spaceUsed(v.."/.")
print(string.format(fstr,v,wrapUnits(st),wrapUnits(su)))
end
end
@ -119,6 +119,18 @@ function shutil.free() -- Displays used and free memory.
print(string.format("%5s %5s %5s",wrapUnits(computer.totalMemory()),wrapUnits(computer.totalMemory()-computer.freeMemory()),wrapUnits(computer.freeMemory())))
end
local function pread(self,len)
syslog(tostring(self))
syslog(tostring(len))
io.input(self.input)
local b = io.read(len)
io.input(self)
if b:match("\3") then
error("terminated")
end
return b
end
function shutil.which(name)
local fpath
for _,dir in ipairs(os.getenv("PATH")) do

View File

@ -116,12 +116,12 @@ function fs.address(path) -- string -- string -- Returns the address of the file
end
function fs.type(path) -- string -- string -- Returns the component type of the filesystem at a given path, if applicable
local fsi,_ = fs.resolve(path)
return fsmounts[fsi].fstype or fsmounts[fsi].type or "filesystem"
return fsmounts[fsi].type or "filesystem"
end
fsmounts["/"] = component.proxy(computer.tmpAddress())
fs.makeDirectory("temp")
if computer.getBootAddress and component.type(computer.getBootAddress()) == "filesystem" then
if computer.getBootAddress then
fs.makeDirectory("boot")
fs.mount("boot",component.proxy(computer.getBootAddress()))
end