add debug argument to reader.lua

Without -d argument, all the debug message will
be suppressed.
pull/2/merge
Qingping Hou 12 years ago
parent c46266fee8
commit c4bd2a1046

@ -33,7 +33,7 @@ longopts = {
password = "p", password = "p",
goto = "g", goto = "g",
gamma = "G", gamma = "G",
device = "d", debug = "d",
help = "h" help = "h"
} }
@ -71,6 +71,7 @@ function showusage()
print("-p, --password=PASSWORD set password for reading PDF document") print("-p, --password=PASSWORD set password for reading PDF document")
print("-g, --goto=page start reading on page") print("-g, --goto=page start reading on page")
print("-G, --gamma=GAMMA set gamma correction") print("-G, --gamma=GAMMA set gamma correction")
print("-d, --debug start in debug mode")
print(" (floating point notation, e.g. \"1.5\")") print(" (floating point notation, e.g. \"1.5\")")
print("-h, --help show this usage help") print("-h, --help show this usage help")
print("") print("")
@ -84,11 +85,19 @@ function showusage()
return return
end end
optarg, optind = alt_getopt.get_opts(ARGV, "p:G:hg:d:", longopts) optarg, optind = alt_getopt.get_opts(ARGV, "p:g:G:hg:dg:", longopts)
if optarg["h"] then if optarg["h"] then
return showusage() return showusage()
end end
if not optarg["d"] then
debug = function() end
end
if optarg["G"] ~= nil then
globalgamma = optarg["G"]
end
if util.isEmulated()==1 then if util.isEmulated()==1 then
input.open("") input.open("")
-- SDL key codes -- SDL key codes
@ -107,10 +116,6 @@ else
end end
end end
if optarg["G"] ~= nil then
globalgamma = optarg["G"]
end
fb = einkfb.open("/dev/fb0") fb = einkfb.open("/dev/fb0")
G_width, G_height = fb:getSize() G_width, G_height = fb:getSize()
-- read current rotation mode -- read current rotation mode

Loading…
Cancel
Save