Ludovic Rousseau wrote:
Hello,

I find it very irritating to have to change a root onwed file
(/etc/opensc/opensc.conf in my case) just to change the debug level in
libopensc.

you should be able to let opensc use a user supplied config file
by setting the OPENSC_CONF env. variable


I propose to add a new way: use OPENSC_DEBUG

So you could do:
$ OPENSC_DEBUG=9 pkcs11-tool --list-slots

You can also make the command quiet even if debug is set in opensc.conf using:
$ OPENSC_DEBUG=0 pkcs11-tool --list-slots

The patch is very simple:

Index: src/libopensc/ctx.c
===================================================================
--- src/libopensc/ctx.c    (révision 3042)
+++ src/libopensc/ctx.c    (copie de travail)
@@ -182,8 +184,13 @@ static int load_parameters(sc_context_t
    int err = 0;
     const scconf_list *list;
     const char *val, *s_internal = "internal";
+    const char *debug = NULL;

     ctx->debug = scconf_get_int(block, "debug", ctx->debug);
+    debug = getenv("OPENSC_DEBUG");
+    if (debug)
+        ctx->debug = atoi(debug);
+
    val = scconf_get_str(block, "debug_file", NULL);
    if (val) {
         if (ctx->debug_file && ctx->debug_file != stdout)


Any objection?

in this special case it actually makes sense to overwrite a
config file entry with a env. variable => no objection.

Cheers,
Nils
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to