comparison cinst/main.c @ 905:698b6a9bd75e

Fix coding style for C code astyle --style=gnu --indent=spaces=2
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 13 Aug 2014 15:49:47 +0200
parents fb69aef056ea
children 76c410aff382
comparison
equal deleted inserted replaced
904:f89b41fa7048 905:698b6a9bd75e
73 * 73 *
74 * @returns: 0 on success. An error code otherwise. 74 * @returns: 0 on success. An error code otherwise.
75 */ 75 */
76 static int 76 static int
77 read_choices_file (char *file_name, char ***to_install, 77 read_choices_file (char *file_name, char ***to_install,
78 char ***to_remove) 78 char ***to_remove)
79 { 79 {
80 int lines_read = 0; 80 int lines_read = 0;
81 char buf[MAX_LINE_LENGTH + 2]; 81 char buf[MAX_LINE_LENGTH + 2];
82 FILE *f = NULL; 82 FILE *f = NULL;
83 long file_size; 83 long file_size;
203 int 203 int
204 main (int argc, char **argv) 204 main (int argc, char **argv)
205 { 205 {
206 /* TODO handle wchar arguments on Windows or do conversion dance */ 206 /* TODO handle wchar arguments on Windows or do conversion dance */
207 char **to_install = NULL, 207 char **to_install = NULL,
208 **to_remove = NULL, 208 **to_remove = NULL,
209 **all_valid_certs = NULL; 209 **all_valid_certs = NULL;
210 int ret = -1; 210 int ret = -1;
211 211
212 char *certificate_list = NULL, 212 char *certificate_list = NULL,
213 *certificate_file_name = NULL, 213 *certificate_file_name = NULL,
214 *choices_file_name = NULL; 214 *choices_file_name = NULL;
215 size_t list_len = 0; 215 size_t list_len = 0;
216 list_status_t list_status; 216 list_status_t list_status;
217 bool do_uninstall = false; 217 bool do_uninstall = false;
218 218
219 /* Some very static argument parsing. list= and choices= is only 219 /* Some very static argument parsing. list= and choices= is only
220 added to make it more transparent how this programm is called if 220 added to make it more transparent how this programm is called if
221 a user looks at the detailed uac dialog. */ 221 a user looks at the detailed uac dialog. */
222 if (argc != 3 || strncmp(argv[1], "list=", 5) != 0 || 222 if (argc != 3 || strncmp(argv[1], "list=", 5) != 0 ||
223 strncmp(argv[2], "choices=", 8) != 0) 223 strncmp(argv[2], "choices=", 8) != 0)
224 { 224 {
225 ERRORPRINTF ("Invalid arguments.\n" 225 ERRORPRINTF ("Invalid arguments.\n"
226 "Expected arguments: list=<certificate_list> \n" 226 "Expected arguments: list=<certificate_list> \n"
227 " choices=<choices_file>|uninstall\n"); 227 " choices=<choices_file>|uninstall\n");
228 return ERR_INVALID_PARAMS; 228 return ERR_INVALID_PARAMS;
282 ret = write_stores_nss (NULL, all_valid_certs); 282 ret = write_stores_nss (NULL, all_valid_certs);
283 return ret; 283 return ret;
284 } 284 }
285 285
286 ret = read_choices_file (choices_file_name, &to_install, 286 ret = read_choices_file (choices_file_name, &to_install,
287 &to_remove); 287 &to_remove);
288 288
289 if (ret) 289 if (ret)
290 { 290 {
291 ERRORPRINTF ("Failed to read choices file\n"); 291 ERRORPRINTF ("Failed to read choices file\n");
292 return ret; 292 return ret;

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