Mercurial > trustbridge
diff cinst/main.c @ 1060:317ee9dc4684
(issue46) Make debug output optional in cinst and mozilla and propagate its setting.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 09 Sep 2014 18:49:02 +0200 |
parents | 78798d3af8f0 |
children | 1e429faf7c84 |
line wrap: on
line diff
--- a/cinst/main.c Tue Sep 09 18:00:37 2014 +0200 +++ b/cinst/main.c Tue Sep 09 18:49:02 2014 +0200 @@ -35,6 +35,8 @@ * to remove all certificates (Even those marked with I) that * are part of the list. * + * For more verbose debug output add --debug to the call. + * **/ #include <stdio.h> #include <stdlib.h> @@ -199,6 +201,7 @@ return 0; } +bool g_debug = false; int main (int argc, char **argv) @@ -219,18 +222,24 @@ /* Some very static argument parsing. list= and choices= is only added to make it more transparent how this programm is called if a user looks at the detailed uac dialog. */ - if (argc != 3 || strncmp(argv[1], "list=", 5) != 0 || + if ((argc != 3 && argc != 4) || strncmp(argv[1], "list=", 5) != 0 || strncmp(argv[2], "choices=", 8) != 0) { ERRORPRINTF ("Invalid arguments.\n" "Expected arguments: list=<certificate_list> \n" - " choices=<choices_file>|uninstall\n"); + " choices=<choices_file>|uninstall\n" + "Optional: --debug\n"); return ERR_INVALID_PARAMS; } certificate_file_name = strchr(argv[1], '=') + 1; choices_file_name = strchr(argv[2], '=') + 1; + if (argc == 4 && strncmp(argv[3], "--debug", 7) == 0) + { + g_debug = true; + } + if (!certificate_file_name || !choices_file_name) { ERRORPRINTF ("Invalid arguments.\n"