dnie-tool: rename option '--driver' to '--card-driver'
Rename option '--driver' to '--card-driver' for increased consistency. In addition, extend it the same way opensc-explorer was extended. I.e. treat the question mark given as argument to option '--card-driver' special: list all available drivers instead of stupidly bailing out. In contrast to opensc-tool and opensc-explorer, which are card-agnostic, I am not sure whether the option '--card-driver' makes sense on this card-specific tool.
This commit is contained in:
parent
a10368769c
commit
5514a0529f
|
@ -97,11 +97,18 @@
|
|||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--driver</option> <replaceable>driver</replaceable>,
|
||||
<option>-c</option> <replaceable>driver</replaceable>
|
||||
<option>--card-driver</option> <replaceable>name</replaceable>,
|
||||
<option>-c</option> <replaceable>name</replaceable>
|
||||
</term>
|
||||
<listitem><para>Specify the card driver <replaceable>driver</replaceable> to use.
|
||||
Default is use driver from configuration file, or auto-detect if absent</para></listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Use the given card driver.
|
||||
The default is to auto-detect the correct card driver.
|
||||
The literal value <literal>?</literal> lists
|
||||
all available card drivers and terminates
|
||||
<command>dnie-tool</command>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
|
|
|
@ -54,7 +54,7 @@ static const char *app_name = "dnie-tool";
|
|||
|
||||
static const struct option options[] = {
|
||||
{"reader", 1, NULL, 'r'},
|
||||
{"driver", 1, NULL, 'c'},
|
||||
{"card-driver", 1, NULL, 'c'},
|
||||
{"wait", 0, NULL, 'w'},
|
||||
{"pin", 1, NULL, 'p'},
|
||||
{"idesp", 0, NULL, 'i'},
|
||||
|
@ -68,7 +68,7 @@ static const struct option options[] = {
|
|||
|
||||
static const char *option_help[] = {
|
||||
"Uses reader number <arg> [0]",
|
||||
"Uses card driver <arg> [auto-detect]",
|
||||
"Uses card driver <arg> [auto-detect; '?' for list]",
|
||||
"Wait for a card to be inserted",
|
||||
"Specify PIN",
|
||||
"Retrieve IDESP",
|
||||
|
@ -150,6 +150,12 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
if (opt_driver != NULL) {
|
||||
/* special card driver value "?" means: list available drivers */
|
||||
if (strncmp("?", opt_driver, sizeof("?")) == 0) {
|
||||
err = util_list_card_drivers(ctx);
|
||||
goto dnie_tool_end;
|
||||
}
|
||||
|
||||
err = sc_set_card_driver(ctx, opt_driver);
|
||||
if (err) {
|
||||
fprintf(stderr, "Driver '%s' not found!\n",
|
||||
|
|
Loading…
Reference in New Issue