]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/lualibs/html_dumplib.lua
Fixed issue with binary files in windows, http://www.lua.org/pil/21.2.2.html
[proxmark3-svn] / client / lualibs / html_dumplib.lua
index d2aee33ba5b5e137d6211c6b6cdc0c3f40770fd4..e730920c0dbc0b142fa35e015fe30ef220cf7253 100644 (file)
@@ -16,6 +16,7 @@ end
 -- This is only meant to be used when errors occur
 local function oops(err)
        print("ERROR: ",err)
+       return nil, err
 end
 
 local function save_HTML(javascript, filename)
@@ -28,7 +29,7 @@ local function save_HTML(javascript, filename)
        
        local outfile = io.open(filename, "w")
        if outfile == nil then 
-               return oops("Could not write to file ", filename)
+               return oops(string.format("Could not write to file %s",tostring(filename)))
        end
        -- Write the data into it
        outfile:write(html)
@@ -88,7 +89,7 @@ local function convert_eml_to_html(input, output)
 
        local infile = io.open(input, "r")
        if infile == nil then 
-               return oops("Could not read file ", input)
+               return oops(string.format("Could not read file %s",tostring(input)))
        end
 
        -- Read file, get JS
@@ -106,9 +107,9 @@ local function convert_bin_to_html(input, output, blockLen)
        blockLen = blockLen or 16
        output = output or input .. 'html'
 
-       local infile = io.open(input, "r")
+       local infile = io.open(input, "rb")
        if infile == nil then 
-               return oops("Could not read file ", input)
+               return oops(string.format("Could not read file %s",tostring(input)))
        end
        -- Read file, get JS
        local javascript = convert_binary_dump_to_JS(infile, blockLen)
Impressum, Datenschutz