Break out print_eval_types().

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23346 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2008-07-14 14:53:51 +00:00
parent f1157b67d7
commit bde1d0fe9c

View File

@@ -1530,6 +1530,25 @@ struct {
} }
}; };
static void
print_eval_types(FILE *out)
{
rtbl_t table;
unsigned i;
table = rtbl_create();
rtbl_add_column_by_id (table, 0, "Name", 0);
rtbl_add_column_by_id (table, 1, "Description", 0);
for (i = 0; i < sizeof(certtypes)/sizeof(certtypes[0]); i++) {
rtbl_add_column_entry_by_id(table, 0, certtypes[i].type);
rtbl_add_column_entry_by_id(table, 1, certtypes[i].desc);
}
rtbl_format (table, out);
rtbl_destroy (table);
}
static int static int
eval_types(hx509_context context, eval_types(hx509_context context,
hx509_ca_tbs tbs, hx509_ca_tbs tbs,
@@ -1554,22 +1573,9 @@ eval_types(hx509_context context,
} }
} }
if (j >= sizeof(certtypes)/sizeof(certtypes[0])) { if (j >= sizeof(certtypes)/sizeof(certtypes[0])) {
rtbl_t table; fprintf(stderr, "Unknown certificate type %s\n\n", type);
fprintf(stderr, "Unknown certificate type %s\n", type);
fprintf(stderr, "Available types:\n"); fprintf(stderr, "Available types:\n");
print_eval_types(stderr);
table = rtbl_create();
rtbl_add_column_by_id (table, 0, "Name", 0);
rtbl_add_column_by_id (table, 1, "Description", 0);
for (j = 0; j < sizeof(certtypes)/sizeof(certtypes[0]); j++) {
rtbl_add_column_entry_by_id(table, 0, certtypes[j].type);
rtbl_add_column_entry_by_id(table, 1, certtypes[j].desc);
}
rtbl_format (table, stderr);
rtbl_destroy (table);
exit(1); exit(1);
} }
} }