diff options
author | pixel <pixel> | 2004-05-02 16:26:34 +0000 |
---|---|---|
committer | pixel <pixel> | 2004-05-02 16:26:34 +0000 |
commit | 423c6d73b2e4492cc3181b425a08499d45e3fe4f (patch) | |
tree | 03d9414f3aff6727d605890507255618db6f3e2b | |
parent | b0ecd395ad3f7ae5d782713dd610a056b1b33c31 (diff) |
Latests updates
-rw-r--r-- | cd-tool.lua | 32 |
1 files changed, 30 insertions, 2 deletions
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) |