mirror of
https://git.shadowkat.net/izaya/OC-PsychOS2.git
synced 2024-11-21 19:44:21 -05:00
Compare commits
3 Commits
265681c61c
...
7fa61e115e
Author | SHA1 | Date | |
---|---|---|---|
|
7fa61e115e | ||
|
87f8bd2149 | ||
|
b88134b70e |
@ -163,10 +163,10 @@ function ed.visual(buffer)
|
|||||||
if cx ~= ox or cy ~= oy or force then
|
if cx ~= ox or cy ~= oy or force then
|
||||||
io.write("\27[2J\27[H")
|
io.write("\27[2J\27[H")
|
||||||
for i = cy, cy+my do
|
for i = cy, cy+my do
|
||||||
print(string.format("\27[31m%4i \27[0m%s",i,(buffer[i] or "\27[36m~"):sub(cx,cx+mx-6)))
|
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)))
|
||||||
end
|
end
|
||||||
elseif mode == "i" then
|
elseif mode == "i" then
|
||||||
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)))
|
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)))
|
||||||
end
|
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[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))
|
io.write(string.format("\27[%i;%iH\27[0m",buffer.x+6-cx,buffer.y-cy+1))
|
||||||
|
@ -38,7 +38,7 @@ function shell.interactive()
|
|||||||
if not f then
|
if not f then
|
||||||
print("\27[31m"..r)
|
print("\27[31m"..r)
|
||||||
else
|
else
|
||||||
local rt = {pcall(f)}
|
local rt = {xpcall(f,debug.traceback)}
|
||||||
local rs = table.remove(rt,1)
|
local rs = table.remove(rt,1)
|
||||||
if not rs then io.write("\27[31m") end
|
if not rs then io.write("\27[31m") end
|
||||||
for k,v in pairs(rt) do
|
for k,v in pairs(rt) do
|
||||||
|
@ -83,7 +83,7 @@ function shutil.df() -- Prints free disk space.
|
|||||||
local fstr = "%-"..tostring(ml).."s %5s %5s"
|
local fstr = "%-"..tostring(ml).."s %5s %5s"
|
||||||
print("fs"..(" "):rep(ml-2).." size used")
|
print("fs"..(" "):rep(ml-2).." size used")
|
||||||
for k,v in pairs(mt) do
|
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)))
|
print(string.format(fstr,v,wrapUnits(st),wrapUnits(su)))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -119,18 +119,6 @@ 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())))
|
print(string.format("%5s %5s %5s",wrapUnits(computer.totalMemory()),wrapUnits(computer.totalMemory()-computer.freeMemory()),wrapUnits(computer.freeMemory())))
|
||||||
end
|
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)
|
function shutil.which(name)
|
||||||
local fpath
|
local fpath
|
||||||
for _,dir in ipairs(os.getenv("PATH")) do
|
for _,dir in ipairs(os.getenv("PATH")) do
|
||||||
|
@ -116,12 +116,12 @@ function fs.address(path) -- string -- string -- Returns the address of the file
|
|||||||
end
|
end
|
||||||
function fs.type(path) -- string -- string -- Returns the component type of the filesystem at a given path, if applicable
|
function fs.type(path) -- string -- string -- Returns the component type of the filesystem at a given path, if applicable
|
||||||
local fsi,_ = fs.resolve(path)
|
local fsi,_ = fs.resolve(path)
|
||||||
return fsmounts[fsi].type or "filesystem"
|
return fsmounts[fsi].fstype or fsmounts[fsi].type or "filesystem"
|
||||||
end
|
end
|
||||||
|
|
||||||
fsmounts["/"] = component.proxy(computer.tmpAddress())
|
fsmounts["/"] = component.proxy(computer.tmpAddress())
|
||||||
fs.makeDirectory("temp")
|
fs.makeDirectory("temp")
|
||||||
if computer.getBootAddress then
|
if computer.getBootAddress and component.type(computer.getBootAddress()) == "filesystem" then
|
||||||
fs.makeDirectory("boot")
|
fs.makeDirectory("boot")
|
||||||
fs.mount("boot",component.proxy(computer.getBootAddress()))
|
fs.mount("boot",component.proxy(computer.getBootAddress()))
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user