[mythtv-commits] Ticket #6484: mythtv-setup: Allow --help options without an X server
MythTV
mythtv at cvs.mythtv.org
Tue Apr 21 19:08:15 UTC 2009
#6484: mythtv-setup: Allow --help options without an X server
----------------------------------------------+-----------------------------
Reporter: sphery <mtdean at thirdcontact.com> | Owner: danielk
Type: patch | Status: new
Priority: minor | Milestone: unknown
Component: MythTV - Channel Scanner | Version: head
Severity: medium | Mlocked: 0
----------------------------------------------+-----------------------------
The attached patch uses some of the new code added with the command-line
channel scanner to allow running mythtv-setup --help without a valid
DISPLAY by setting use_display to false for -h, --help, and --usage .
Note that the patch modifies the early-command-line-checking loop that was
already there. The original for loop was designed to loop over one less
than the total number of arguments (because it was originally used for
-geometry and -display, which both require values/an argument following
the switch). Therefore, I modified the loop test (removing the + 1) such
that it now loops over all arguments (no longer requiring a trailing value
before parsing the option). I then added the appropriate bounds checks
for the -geometry and -display parsing code.
Though some of the --scan* arguments actually require a value, I did not
perform any "additional value" bounds checks in the early parsing for
--scan* simply because if --scan* is set to always require values, --scan-
list, --scan-save-only, --scan-non-interactive (which do not require
values) fail on a system without a DISPLAY with:
mythtv-setup: cannot connect to X server
and a command like:
mythtv-setup --scan
would fail with the same error, rather than the desired:
You must enter a valid cardid to scan.
Valid cards:
1: <whatever>
Also, the "late" command-line checking code for all the --scan* arguments
properly checks boundaries before grabbing the value associated with the
argument, so it makes more sense to always parse the --scan* arguments in
the early loop.
Thanks to lcase on IRC for letting me know that --help could only be used
with a valid X display.
--
Ticket URL: <http://svn.mythtv.org/trac/ticket/6484>
MythTV <http://www.mythtv.org/>
MythTV
More information about the mythtv-commits
mailing list