add a verbose option that overrides all others

This commit is contained in:
Yves Rutschle committed 2024-07-10 15:31:55 +02:00
1 parent 06b7d7ed14
commit b619f5bf36
7 files changed
+76 -27

No files matched your search

+39 -21
View File
@@ -1,5 +1,5 @@
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
* on Tue Jan 2 21:25:47 2024.
* on Wed Jul 10 15:27:23 2024.
# conf2struct: generate libconf parsers that read to structs
# Copyright (C) 2018-2021 Yves Rutschle
@@ -443,6 +443,7 @@ struct compound_cl_arg {
struct arg_file* sslhcfg_conffile;
struct arg_int* sslhcfg_verbose;
struct arg_int* sslhcfg_verbose_config;
struct arg_int* sslhcfg_verbose_config_error;
struct arg_int* sslhcfg_verbose_connections;
@@ -814,10 +815,26 @@ static struct config_desc table_sslhcfg_listen[] = {
},
{ 0 }
};
static struct config_desc table_sslhcfg[] = {
{
/* name */ "verbose",
/* type */ CFG_INT,
/* sub_group*/ NULL,
/* arg_cl */ & sslhcfg_verbose,
/* base_addr */ NULL,
/* offset */ offsetof(struct sslhcfg_item, verbose),
/* offset_len */ 0,
/* offset_present */ 0,
/* size */ sizeof(int),
/* array_type */ -1,
/* mandatory */ 0,
/* optional */ 0,
/* default_val*/ .default_val.def_int = 0
},
{
/* name */ "verbose_config",
/* type */ CFG_INT,
@@ -1372,7 +1389,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: listen */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_listen,
.base_entry = & table_sslhcfg [25],
.base_entry = & table_sslhcfg [26],
.targets = sslhcfg_listen_targets,
@@ -1384,7 +1401,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: ssh */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_ssh,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_ssh_targets,
@@ -1396,7 +1413,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: tls */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_tls,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_tls_targets,
@@ -1408,7 +1425,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: ssl */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_ssl,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_ssl_targets,
@@ -1420,7 +1437,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: openvpn */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_openvpn,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_openvpn_targets,
@@ -1432,7 +1449,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: tinc */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_tinc,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_tinc_targets,
@@ -1444,7 +1461,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: wireguard */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_wireguard,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_wireguard_targets,
@@ -1456,7 +1473,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: xmpp */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_xmpp,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_xmpp_targets,
@@ -1468,7 +1485,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: http */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_http,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_http_targets,
@@ -1480,7 +1497,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: adb */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_adb,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_adb_targets,
@@ -1492,7 +1509,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: socks5 */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_socks5,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_socks5_targets,
@@ -1504,7 +1521,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: syslog */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_syslog,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_syslog_targets,
@@ -1516,7 +1533,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: msrdp */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_msrdp,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_msrdp_targets,
@@ -1528,7 +1545,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: anyprot */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_anyprot,
.base_entry = & table_sslhcfg [26],
.base_entry = & table_sslhcfg [27],
.targets = sslhcfg_anyprot_targets,
@@ -2193,6 +2210,7 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
#ifdef LIBCONFIG
sslhcfg_conffile = arg_filen("F", "config", "<file>", 0, 1, "Specify configuration file"),
#endif
sslhcfg_verbose = arg_intn(NULL, "verbose", "<n>", 0, 1, "Override all verbosness options"),
sslhcfg_verbose_config = arg_intn(NULL, "verbose-config", "<n>", 0, 1, "Print configuration at startup"),
sslhcfg_verbose_config_error = arg_intn(NULL, "verbose-config-error", "<n>", 0, 1, "Print configuration errors"),
sslhcfg_verbose_connections = arg_intn(NULL, "verbose-connections", "<n>", 0, 1, "Trace established incoming address to forward address"),
@@ -2239,13 +2257,10 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
/* Parse command line */
nerrors = arg_parse(argc, argv, argtable);
if (nerrors) {
// print bad args
arg_print_errors(stdout, sslhcfg_end, "sslhcfg");
// print usage
arg_print_errors(stdout, sslhcfg_end, "sslhcfg");
arg_print_syntax(stdout, argtable, "\n");
// print options
arg_print_glossary(stdout, argtable, " %-25s\t%s\n");
fprintf(stderr, "Invalid args are ignored, please fix them\n");
return -1;
}
@@ -2382,6 +2397,9 @@ void sslhcfg_fprint(
int depth)
{
int i;
indent(out, depth);
fprintf(out, "verbose: %d", sslhcfg->verbose);
fprintf(out, "\n");
indent(out, depth);
fprintf(out, "verbose_config: %d", sslhcfg->verbose_config);
fprintf(out, "\n");