* @param fp File to write to
* @param dn Distinguished Name
* @param key Key string
- * @retval 1 If any DN keys match the given key string
- * @retval 0 Otherwise
+ * @retval true If any DN keys match the given key string
+ * @retval false Otherwise
*
* Print the X.500 Distinguished Name part KEY from the array of parts DN to FP.
*/
-static int print_dn_part(FILE *fp, struct DnArray *dn, const char *key)
+bool print_dn_part(FILE *fp, struct DnArray *dn, const char *key)
{
- int any = 0;
+ bool any = false;
for (; dn->key; dn++)
{
if (any)
fputs(" + ", fp);
print_utf8(fp, dn->value, strlen(dn->value));
- any = 1;
+ any = true;
}
}
return any;
static const char *const stdpart[] = {
"CN", "OU", "O", "STREET", "L", "ST", "C", NULL,
};
- int any = 0, any2 = 0, i;
+ bool any = false;
+ bool any2 = false;
- for (i = 0; stdpart[i]; i++)
+ for (int i = 0; stdpart[i]; i++)
{
if (any)
fputs(", ", fp);
/* now print the rest without any specific ordering */
for (; dn->key; dn++)
{
+ int i;
for (i = 0; stdpart[i]; i++)
{
if (strcmp(dn->key, stdpart[i]) == 0)
if (!any2)
fputs("(", fp);
any = print_dn_part(fp, dn, dn->key);
- any2 = 1;
+ any2 = true;
}
}
if (any2)