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
This commit is contained in:
martin 2010-10-20 07:53:19 +00:00
parent 2d6e3bd262
commit 6a750e6cc0
6 changed files with 26 additions and 6 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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)
{