Compare commits

..

4 Commits

4 changed files with 20 additions and 2 deletions

View File

@ -7,5 +7,5 @@ echo _OSVERSION=\"PsychOS 2.0a1-$(git rev-parse --short HEAD)\" > target/version
cat target/version.lua target/init.lua > target/tinit.lua
mv target/tinit.lua target/init.lua
cp -r exec/ service/ lib/ target/
cp default-init.txt target/cfg/
cp default-init.txt target/cfg/init.txt
lua finddesc.lua $(find module/ -type f) $(find lib/ -type f) > apidoc.md

View File

@ -1,2 +1,2 @@
print("Total Used Free")
print(string.format("%4dK %4dK %4dK",computer.totalMemory()/1024,math.floor((computer.totalMemory()-computer.freeMemory())/1024),math.floor(computer.freeMemory()/1024)))
print(string.format("%4iK %4iK %4iK",math.floor(computer.totalMemory()/1024),math.floor((computer.totalMemory()-computer.freeMemory())/1024),math.floor(computer.freeMemory()/1024)))

View File

@ -4,6 +4,14 @@ end
os.setenv("PWD","/boot")
io.input("/dev/null")
io.output("/dev/syslog")
local f = io.open("/boot/cfg/hostname","rb")
local hostname = computer.address():sub(1,8)
if f then
hostname = f:read("*l")
f:close()
end
os.setenv("HOSTNAME",hostname)
syslog(string.format("Hostname set to %s",hostname))
local pids = {}
local function loadlist()
local f = io.open("/boot/cfg/init.txt","rb")

View File

@ -42,6 +42,16 @@ local function fread(self,length)
rstr = rstr .. lstr
until rstr:len() == length or lstr == ""
return rstr
elseif type(length) == "string" then
local buf = ""
if length == "*l" then
length = "\n"
end
repeat
local rb = fsmounts[self.fs].read(self.fid,1) or ""
buf = buf .. rb
until buf:match(length) or rb == ""
return buf:match("(.*)"..length)
end
return fsmounts[self.fs].read(self.fid,length)
end