From 6a750e6cc0f5d8ec9e2ed4b597503938c57e57b3 Mon Sep 17 00:00:00 2001 From: martin Date: Wed, 20 Oct 2010 07:53:19 +0000 Subject: [PATCH] tools: -v sets ctx->debug only if set more than once. -vv also makes the debug go to stderr. git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4818 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/tools/netkey-tool.c | 5 ++++- src/tools/piv-tool.c | 5 +++++ src/tools/pkcs15-crypt.c | 5 ++++- src/tools/pkcs15-tool.c | 6 +++++- src/tools/rutoken-tool.c | 5 ++++- src/tools/westcos-tool.c | 6 ++++-- 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/tools/netkey-tool.c b/src/tools/netkey-tool.c index ce54edc5..b9e28765 100644 --- a/src/tools/netkey-tool.c +++ b/src/tools/netkey-tool.c @@ -542,7 +542,10 @@ int main( fprintf(stderr,"Establish-Context failed: %s\n", sc_strerror(r)); exit(1); } - ctx->debug=debug; + if (debug > 1) { + ctx->debug = debug; + ctx->debug_file = stderr; + } if(ctx->debug>0) printf("Context for application \"%s\" created, Debug=%d\n", ctx->app_name, ctx->debug); diff --git a/src/tools/piv-tool.c b/src/tools/piv-tool.c index 30ff62be..b692e4ca 100644 --- a/src/tools/piv-tool.c +++ b/src/tools/piv-tool.c @@ -518,6 +518,11 @@ int main(int argc, char * const argv[]) return 1; } + if (verbose > 1) { + ctx->debug = verbose; + ctx->debug_file = stderr; + } + if (action_count <= 0) goto end; diff --git a/src/tools/pkcs15-crypt.c b/src/tools/pkcs15-crypt.c index 943730a4..79164537 100644 --- a/src/tools/pkcs15-crypt.c +++ b/src/tools/pkcs15-crypt.c @@ -568,7 +568,10 @@ int main(int argc, char * const argv[]) return 1; } - ctx->debug = verbose; + if (verbose > 1) { + ctx->debug = verbose; + ctx->debug_file = stderr; + } err = util_connect_card(ctx, &card, opt_reader, opt_wait, verbose); if (err) diff --git a/src/tools/pkcs15-tool.c b/src/tools/pkcs15-tool.c index f6050d05..17ff2590 100644 --- a/src/tools/pkcs15-tool.c +++ b/src/tools/pkcs15-tool.c @@ -1714,8 +1714,12 @@ int main(int argc, char * const argv[]) fprintf(stderr, "Failed to establish context: %s\n", sc_strerror(r)); return 1; } - ctx->debug = verbose; + if (verbose > 1) { + ctx->debug = verbose; + ctx->debug_file = stderr; + } + err = util_connect_card(ctx, &card, opt_reader, opt_wait, verbose); if (err) goto end; diff --git a/src/tools/rutoken-tool.c b/src/tools/rutoken-tool.c index 0d54c0d5..01f055f9 100644 --- a/src/tools/rutoken-tool.c +++ b/src/tools/rutoken-tool.c @@ -487,7 +487,10 @@ int main(int argc, char* argv[]) return -1; } - ctx->debug = opt_debug; + if (opt_debug > 1) { + ctx->debug = opt_debug; + ctx->debug_file = stderr; + } if (util_connect_card(ctx, &card, opt_reader, opt_wait, opt_debug) != 0) err = -1; diff --git a/src/tools/westcos-tool.c b/src/tools/westcos-tool.c index d158f6ea..ff5e83e4 100644 --- a/src/tools/westcos-tool.c +++ b/src/tools/westcos-tool.c @@ -440,8 +440,10 @@ int main(int argc, char *argv[]) return 1; } - if (verbose > 1) - ctx->debug = verbose-1; + if (verbose > 1) { + ctx->debug = verbose; + ctx->debug_file = stderr; + } if (opt_driver != NULL) {