Compare commits

..

No commits in common. "f92cbde89b0bacc5d8efeb091d7003fed815319c" and "106388416efe4cdcb17016b417173bda35f75412" have entirely different histories.

4 changed files with 0 additions and 171 deletions

View File

@ -1,60 +0,0 @@
local fs = component.proxy(computer.tmpAddress())
local init = function() end
do
local tape = component.proxy(component.list("tape_drive")())
local rev,namesize,filesize,name,mode = false, 0, 0, "", 0
local function readint(amt)
local tmp = 0
for i=(rev and amt) or 1, (rev and 1) or amt, (rev and -1) or 1 do
tmp = tmp | (tape.read(1):byte() << ((i-1)*8))
end
return tmp
end
local function fwrite()
local dir = name:match("(.+)/.*%.?.+")
if (dir) then
fs.makeDirectory("/"..dir)
end
local fh = fs.open(name, "w")
fs.write(fh,tape.read(filesize))
fs.close(fh)
end
tape.seek(-math.huge)
while true do
local magic = readint(2)
if magic == 51057 then rev = true end
tape.seek(4)
mode = readint(2)
tape.seek(12)
namesize = readint(2)
filesize = (readint(2) << 16) | readint(2)
name = tape.read(namesize):sub(1, namesize-1)
if name == "TRAILER!!!" then break end
if (namesize % 2 ~= 0) then
tape.seek(1)
end
if (mode & 32768 ~= 0) then
fwrite()
end
if (filesize % 2 ~= 0) then
tape.seek(1)
end
computer.beep()
end
end
do
local f=fs.open("/init.lua","rb")
if not f then error("no init.lua") end
local initstr = ""
local data = ""
repeat
initstr = initstr .. data
data = fs.read(f,2048)
until data == nil
init = load(initstr)
end
computer.getBootAddress = computer.tmpAddress
init()

View File

@ -1,24 +0,0 @@
local tArgs = {...}
local function cint(n,l)
local t={}
for i = 0, 7 do
t[i+1] = (n >> (i * 8)) & 0xFF
end
return string.reverse(string.char(table.unpack(t)):sub(1,l))
end
local function genHeader(fname,len)
return string.format("%s%s%s",cint(fname:len(),2),fname,cint(len,2))
end
for k,v in ipairs(tArgs) do
local f = io.open(v,"rb")
if f then
local content = f:read("*a")
f:close()
io.write(genHeader(v,content:len()))
io.write(content)
end
end
io.write(string.char(0):rep(2))

View File

@ -1,58 +0,0 @@
local fs = component.proxy(computer.tmpAddress())
local init = function() end
if fs.exists("/init.lua") then
do
local tape = component.proxy(component.list("tape_drive")())
local function toint(s)
s=s or ""
local n = 0
local i = 1
while true do
local p = s:sub(i,i)
if p == "" then break end
local b = string.byte(p)
n = n << 8
n = n | b
i=i+1
end
return n
end
local function fwrite(name,len)
local dir = name:match("(.+)/.*%.?.+")
if (dir) then
fs.makeDirectory("/"..dir)
end
local fh = fs.open(name, "w")
fs.write(fh,tape.read(len))
fs.close(fh)
end
tape.seek(-math.huge)
while true do
local nlen = toint(tape.read(2))
if nlen == 0 then
break
end
local name = tape.read(nlen)
local fsize = toint(tape.read(2))
fwrite(name,fsize)
computer.beep()
end
end
end
do
local f=fs.open("/init.lua","rb")
if not f then error("no init.lua") end
local initstr = ""
local data = ""
repeat
initstr = initstr .. data
data = fs.read(f,2048)
until data == nil
init = load(initstr)
end
computer.getBootAddress = computer.tmpAddress
init()

View File

@ -1,29 +0,0 @@
local tArgs = {...}
local function toint(s)
s=s or ""
local n = 0
local i = 1
while true do
local p = s:sub(i,i)
if p == "" then break end
local b = string.byte(p)
n = n << 8
n = n | b
i=i+1
end
return n
end
local fi = io.open(tArgs[1])
while true do
local nlen = toint(fi:read(2))
if nlen == 0 then
break
end
local name = fi:read(nlen)
local fsize = toint(fi:read(2))
local fcontent = fi:read(fsize)
print(name,fsize)
end
fi:close()