comparison 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
comparison
equal deleted inserted replaced
1059:f638eb1f3b0f 1060:317ee9dc4684
32 * built in key. 32 * built in key.
33 * 33 *
34 * The special instruction "uninstall" will cause the installer 34 * The special instruction "uninstall" will cause the installer
35 * to remove all certificates (Even those marked with I) that 35 * to remove all certificates (Even those marked with I) that
36 * are part of the list. 36 * are part of the list.
37 *
38 * For more verbose debug output add --debug to the call.
37 * 39 *
38 **/ 40 **/
39 #include <stdio.h> 41 #include <stdio.h>
40 #include <stdlib.h> 42 #include <stdlib.h>
41 #include <string.h> 43 #include <string.h>
197 } 199 }
198 200
199 return 0; 201 return 0;
200 } 202 }
201 203
204 bool g_debug = false;
202 205
203 int 206 int
204 main (int argc, char **argv) 207 main (int argc, char **argv)
205 { 208 {
206 /* TODO handle wchar arguments on Windows or do conversion dance */ 209 /* TODO handle wchar arguments on Windows or do conversion dance */
217 bool do_uninstall = false; 220 bool do_uninstall = false;
218 221
219 /* Some very static argument parsing. list= and choices= is only 222 /* Some very static argument parsing. list= and choices= is only
220 added to make it more transparent how this programm is called if 223 added to make it more transparent how this programm is called if
221 a user looks at the detailed uac dialog. */ 224 a user looks at the detailed uac dialog. */
222 if (argc != 3 || strncmp(argv[1], "list=", 5) != 0 || 225 if ((argc != 3 && argc != 4) || strncmp(argv[1], "list=", 5) != 0 ||
223 strncmp(argv[2], "choices=", 8) != 0) 226 strncmp(argv[2], "choices=", 8) != 0)
227 {
228 ERRORPRINTF ("Invalid arguments.\n"
229 "Expected arguments: list=<certificate_list> \n"
230 " choices=<choices_file>|uninstall\n"
231 "Optional: --debug\n");
232 return ERR_INVALID_PARAMS;
233 }
234
235 certificate_file_name = strchr(argv[1], '=') + 1;
236 choices_file_name = strchr(argv[2], '=') + 1;
237
238 if (argc == 4 && strncmp(argv[3], "--debug", 7) == 0)
239 {
240 g_debug = true;
241 }
242
243 if (!certificate_file_name || !choices_file_name)
224 { 244 {
225 ERRORPRINTF ("Invalid arguments.\n" 245 ERRORPRINTF ("Invalid arguments.\n"
226 "Expected arguments: list=<certificate_list> \n" 246 "Expected arguments: list=<certificate_list> \n"
227 " choices=<choices_file>|uninstall\n"); 247 " choices=<choices_file>|uninstall\n");
228 return ERR_INVALID_PARAMS; 248 return ERR_INVALID_PARAMS;
229 } 249 }
230 250
231 certificate_file_name = strchr(argv[1], '=') + 1;
232 choices_file_name = strchr(argv[2], '=') + 1;
233
234 if (!certificate_file_name || !choices_file_name)
235 {
236 ERRORPRINTF ("Invalid arguments.\n"
237 "Expected arguments: list=<certificate_list> \n"
238 " choices=<choices_file>|uninstall\n");
239 return ERR_INVALID_PARAMS;
240 }
241
242 if (strncmp(choices_file_name, "uninstall", 9) == 0) 251 if (strncmp(choices_file_name, "uninstall", 9) == 0)
243 { 252 {
244 do_uninstall = true; 253 do_uninstall = true;
245 choices_file_name = NULL; 254 choices_file_name = NULL;
246 } 255 }

http://wald.intevation.org/projects/trustbridge/