diff options
| author | ruki <[email protected]> | 2021-12-05 23:03:30 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-12-05 23:03:30 +0800 |
| commit | 8787117f775151203132c228d40f5d1f672b0dda (patch) | |
| tree | 7b731233c5b99334334fd0976a3e3bc060ed5c8a /xmake/modules/private/utils/bin2c.lua | |
| parent | dd73ec4a233de28620627e8025ce8f83ab901f3b (diff) | |
Update bin2c.lua
Diffstat (limited to 'xmake/modules/private/utils/bin2c.lua')
| -rw-r--r-- | xmake/modules/private/utils/bin2c.lua | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/xmake/modules/private/utils/bin2c.lua b/xmake/modules/private/utils/bin2c.lua index edb89731c..409162f00 100644 --- a/xmake/modules/private/utils/bin2c.lua +++ b/xmake/modules/private/utils/bin2c.lua @@ -23,10 +23,10 @@ import("core.base.bytes") import("core.base.option") local options = { - {'w', "linewidth", "kv", nil, "Set the line width"}, - {'z', "zeroend", "k", true, "Patch zero terminating character"}, - {'i', "binarypath", "kv", nil, "Set the binary file path."}, - {'o', "outputpath", "kv", nil, "Set the output file path."} + {'w', "linewidth", "kv", nil, "Set the line width"}, + {nil, "nozeroend", "k", false, "Disable to patch zero terminating character"}, + {'i', "binarypath", "kv", nil, "Set the binary file path."}, + {'o', "outputpath", "kv", nil, "Set the output file path."} } function _do_dump(binarydata, outputfile, opt) @@ -85,7 +85,7 @@ function _do_bin2c(binarypath, outputpath, opt) local binarydata = bytes(io.readfile(binarypath, {encoding = "binary"})) local outputfile = io.open(outputpath, 'w') if outputfile then - if opt.zeroend then + if opt.nozeroend then binarydata = binarydata .. bytes('\0') end _do_dump(binarydata, outputfile, opt) @@ -99,7 +99,6 @@ end -- main entry function main(...) - print("sss") -- parse arguments local argv = {...} local opt = option.parse(argv, options, "Print c/c++ code files from the given binary file." |
