-S now means "seek to"

This commit is contained in:
Casey 2023-10-18 01:11:38 +03:00
parent b4d4d64c16
commit c713e0118d
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 7 additions and 10 deletions

View File

@ -1,10 +1,10 @@
local args = { ... } local args = { ... }
local shouldSeek = true local seekTo = 0
local driveName = nil local driveName = nil
if args[1] == "-S" then if args[1] == "-S" then
shouldSeek = false
table.remove(args, 1) table.remove(args, 1)
seekTo = tonumber(table.remove(args, 1))
end end
if args[1] == "-D" then if args[1] == "-D" then
table.remove(args, 1) table.remove(args, 1)
@ -93,10 +93,9 @@ if length > tape.getSize() then
end end
tape.stop() tape.stop()
if shouldSeek then tape.seek(-tape.getSize())
tape.seek(-tape.getSize()) tape.seek(seekTo)
tape.stop() tape.stop()
end
local _, y = term.getCursorPos() local _, y = term.getCursorPos()
local written = 0 local written = 0
@ -121,7 +120,5 @@ term.clearLine()
print("Written "..n_to_kib(written)) print("Written "..n_to_kib(written))
tape.stop() tape.stop()
if shouldSeek then tape.seek(-tape.getSize())
tape.seek(-tape.getSize()) tape.stop()
tape.stop()
end