3 namespace WebProvisioning
7 public static int main (string[] args)
10 int force_flat_file_store = 0;
11 bool bad_switch = false;
12 for (arg_index = 1; arg_index < args.length; arg_index++) {
15 string arg = args[arg_index];
16 if (arg.get_next_char(ref index, out c)) {
17 if ((c=='-') && arg.get_next_char(ref index, out c)) {
20 force_flat_file_store = 1;
27 break; // arg is not a switch; presume it's the file
30 if (bad_switch || (arg_index != args.length - 1))
32 error ("Usage %s [-f] WEB_PROVISIONING_FILE\n -f: add identities to flat file store", args[0]);
34 string webp_file = args[arg_index];
36 if (!FileUtils.test (webp_file, FileTest.EXISTS | FileTest.IS_REGULAR))
38 error ("%s does not exist", webp_file);
41 var webp = new Parser (webp_file);
44 foreach (IdCard card in cards)
47 string[] rules_patterns = {};
48 string[] rules_always_confirm = {};
50 if (card.rules.length > 0)
53 rules_patterns = new string[card.rules.length];
54 rules_always_confirm = new string[card.rules.length];
55 foreach (Rule r in card.rules)
57 rules_patterns[i] = r.pattern;
58 rules_always_confirm[i] = r.always_confirm;
63 Moonshot.install_id_card (card.display_name,
70 card.trust_anchor.ca_cert,
71 card.trust_anchor.subject,
72 card.trust_anchor.subject_alt,
73 card.trust_anchor.server_cert,
74 force_flat_file_store,
79 stderr.printf ("Error: %s", error.message);