2 * Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
12 #include <openssl/bio.h>
13 #include <openssl/conf.h>
14 #include <openssl/safestack.h>
15 #include <openssl/err.h>
17 static void dump_section(const char *name, const CONF *cnf)
19 STACK_OF(CONF_VALUE) *sect = NCONF_get_section(cnf, name);
22 printf("[ %s ]\n", name);
23 for (i = 0; i < sk_CONF_VALUE_num(sect); i++) {
24 CONF_VALUE *cv = sk_CONF_VALUE_value(sect, i);
26 printf("%s = %s\n", cv->name, cv->value);
30 int main(int argc, char **argv)
33 CONF *conf = NCONF_new(NCONF_default());
35 STACK_OF(OPENSSL_CSTRING) *section_names = NULL;
37 if (conf != NULL && NCONF_load(conf, argv[1], &eline)) {
40 section_names = NCONF_get_section_names(conf);
41 for (i = 0; i < sk_OPENSSL_CSTRING_num(section_names); i++) {
42 dump_section(sk_OPENSSL_CSTRING_value(section_names, i), conf);
44 sk_OPENSSL_CSTRING_free(section_names);
47 ERR_print_errors_fp(stderr);