From 423c6d73b2e4492cc3181b425a08499d45e3fe4f Mon Sep 17 00:00:00 2001 From: pixel Date: Sun, 2 May 2004 16:26:34 +0000 Subject: Latests updates --- cd-tool.lua | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'cd-tool.lua') diff --git a/cd-tool.lua b/cd-tool.lua index 7b37d0f..30ebd34 100644 --- a/cd-tool.lua +++ b/cd-tool.lua @@ -2,6 +2,30 @@ -- misc functions -- ------------------ +function extract_file(source, dest, mode) + if (mode == nil) then + source = cdfile(findpath(source)) + else + source = cdfile(findpath(source), mode) + end + dest = Output(dest) + source.copyto(dest) +end + +function insert_file(source, dest, mode) + if (type(source) == "string") then + source = Input(source) + end + if (type(dest) == "string") then + dest = findpath(dest) + end + if (mode == nil) then + writefile(source, -1, dest.Sector) + else + writefile(source, -1, dest.Sector, mode) + end +end + function display(inp) if (type(inp) == "string") then inp = Input(inp) @@ -16,7 +40,7 @@ end function pchar(n) if (not ((n >= 32) and (n <= 127))) then - n = 46 + n = 46 -- a dot, 0x2e. end return hex(n, "%c") end @@ -209,7 +233,11 @@ end function findpath(path) check_cdutil() - return cdutil:findpath(path) + if (findpath == nil) then + return cdutil:findpath "/" + else + return cdutil:findpath(path) + end end function findparent(path) -- cgit v1.2.3