tools: use consistent behavior of -v
-v switches to debug output to stderr in OpenSC tools regardless of the opensc.conf setting
This commit is contained in:
parent
0af46c88b7
commit
fbb4d1f843
|
@ -1090,11 +1090,6 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
if (opt_driver != NULL) {
|
||||
err = sc_set_card_driver(ctx, opt_driver);
|
||||
if (err) {
|
||||
|
|
|
@ -1073,11 +1073,6 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
err = util_connect_card(ctx, &card, opt_reader, opt_wait, verbose);
|
||||
printf("Using card driver: %s\n", card->driver->name);
|
||||
|
||||
|
|
|
@ -149,11 +149,6 @@ int main(int argc, char* argv[])
|
|||
goto dnie_tool_end;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx,"stderr");
|
||||
}
|
||||
|
||||
if (opt_driver != NULL) {
|
||||
err = sc_set_card_driver(ctx, opt_driver);
|
||||
if (err) {
|
||||
|
|
|
@ -480,9 +480,6 @@ int main(int argc, char * argv[])
|
|||
const char *opt_new_key = NULL;
|
||||
sc_context_param_t ctx_param;
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
while (1) {
|
||||
c = getopt_long(argc, argv, "XUCr:wv", options, &long_optind);
|
||||
if (c == -1)
|
||||
|
@ -553,12 +550,6 @@ int main(int argc, char * argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
/* Only change if not in opensc.conf */
|
||||
if (verbose > 1 && ctx->debug == 0) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
r = util_connect_card(ctx, &card, opt_reader, opt_wait, verbose);
|
||||
if (r != SC_SUCCESS) {
|
||||
if (r < 0) {
|
||||
|
|
|
@ -205,9 +205,6 @@ int main(int argc, char *argv[])
|
|||
int action_count = 0;
|
||||
sc_context_param_t ctx_param;
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
while (1) {
|
||||
c = getopt_long(argc, argv, "v", options, &long_optind);
|
||||
if (c == -1)
|
||||
|
@ -247,12 +244,6 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Only change if not in opensc.conf */
|
||||
if (verbose > 1 && ctx->debug == 0) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
if (action_count <= 0)
|
||||
goto end;
|
||||
|
||||
|
|
|
@ -533,10 +533,6 @@ int main(
|
|||
fprintf(stderr,"Establish-Context failed: %s\n", sc_strerror(r));
|
||||
exit(1);
|
||||
}
|
||||
if (debug > 1) {
|
||||
ctx->debug = debug;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
if(ctx->debug>0)
|
||||
printf("Context for application \"%s\" created, Debug=%d\n", ctx->app_name, ctx->debug);
|
||||
|
||||
|
|
|
@ -867,11 +867,6 @@ int main(int argc, char **argv)
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
r = util_connect_card(ctx, &card, opt_reader, opt_wait, verbose);
|
||||
if (r) {
|
||||
util_fatal("failed to connect to card: %s", sc_strerror(r));
|
||||
|
|
|
@ -714,9 +714,6 @@ int main(int argc, char *argv[])
|
|||
char **p;
|
||||
sc_context_param_t ctx_param;
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
while (1) {
|
||||
c = getopt_long(argc, argv, "inlG:S:fr:vs:Dc:aw", options, &long_optind);
|
||||
if (c == -1)
|
||||
|
@ -829,11 +826,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
ctx->flags |= SC_CTX_FLAG_ENABLE_DEFAULT_DRIVER;
|
||||
|
||||
if (verbose > 1) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
if (do_get_conf_entry) {
|
||||
if ((err = opensc_get_conf_entry (opt_conf_entry)))
|
||||
goto end;
|
||||
|
|
|
@ -487,9 +487,6 @@ int main(int argc, char *argv[])
|
|||
sc_context_param_t ctx_param;
|
||||
char **old_apdus = NULL;
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
while (1) {
|
||||
c = getopt_long(argc, argv, "nA:G:O:Z:C:i:o:fvs:c:w", options, &long_optind);
|
||||
if (c == -1)
|
||||
|
@ -601,12 +598,6 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Only change if not in opensc.conf */
|
||||
if (verbose > 1 && ctx->debug == 0) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
if (action_count <= 0)
|
||||
goto end;
|
||||
|
||||
|
|
|
@ -475,11 +475,6 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
err = util_connect_card_ex(ctx, &card, opt_reader, opt_wait, 0, verbose);
|
||||
if (err)
|
||||
goto end;
|
||||
|
|
|
@ -667,11 +667,6 @@ open_reader_and_card(char *reader)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
if (util_connect_card_ex(ctx, &card, reader, opt_wait, 0, verbose))
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -2295,11 +2295,6 @@ int main(int argc, char *argv[])
|
|||
action_count--;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
err = util_connect_card_ex(ctx, &card, opt_reader, opt_wait, 0, verbose);
|
||||
if (err)
|
||||
goto end;
|
||||
|
|
|
@ -1675,9 +1675,6 @@ int main(int argc, char *argv[])
|
|||
int opt_iter = 10000000;
|
||||
sc_context_param_t ctx_param;
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
while (1) {
|
||||
c = getopt_long(argc, argv, "XC:I:P:W:U:s:i:fr:wv", options, &long_optind);
|
||||
if (c == -1)
|
||||
|
@ -1776,12 +1773,6 @@ int main(int argc, char *argv[])
|
|||
exit(1);
|
||||
}
|
||||
|
||||
/* Only change if not in opensc.conf */
|
||||
if (verbose > 1 && ctx->debug == 0) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
r = util_connect_card_ex(ctx, &card, opt_reader, opt_wait, 0, verbose);
|
||||
if (r != SC_SUCCESS) {
|
||||
if (r < 0) {
|
||||
|
|
|
@ -56,8 +56,16 @@ util_connect_card_ex(sc_context_t *ctx, sc_card_t **cardp,
|
|||
struct sc_card *card = NULL;
|
||||
int r;
|
||||
|
||||
setbuf(stderr, NULL);
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
sc_notify_init();
|
||||
|
||||
if (verbose) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
if (do_wait) {
|
||||
unsigned int event;
|
||||
|
||||
|
|
|
@ -443,11 +443,6 @@ int main(int argc, char *argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (verbose > 1) {
|
||||
ctx->debug = verbose;
|
||||
sc_ctx_log_to_file(ctx, "stderr");
|
||||
}
|
||||
|
||||
if (opt_driver != NULL)
|
||||
{
|
||||
r = sc_set_card_driver(ctx, opt_driver);
|
||||
|
|
Loading…
Reference in New Issue