diff --git a/apps/backend/backend_main.c b/apps/backend/backend_main.c index 971c9f7c..f1f55164 100644 --- a/apps/backend/backend_main.c +++ b/apps/backend/backend_main.c @@ -614,9 +614,7 @@ main(int argc, case 'l' : break; /* see above */ case 'C': /* Explicitly dump configuration */ - if (!strlen(optarg)) - usage(h, argv[0]); - if ((config_dump_format = format_str2int(optarg)) < 0){ + if ((config_dump_format = format_str2int(optarg)) == (enum format_enum)-1){ fprintf(stderr, "Unrecognized dump format: %s(expected: xml|json|text)\n", argv[0]); usage(h, argv[0]); } diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c index 56f875cf..3600aa8e 100644 --- a/apps/cli/cli_main.c +++ b/apps/cli/cli_main.c @@ -613,9 +613,7 @@ main(int argc, case 'l': /* Log destination */ break; /* see above */ case 'C': /* Explicitly dump configuration */ - if (!strlen(optarg)) - usage(h, argv[0]); - if ((config_dump_format = format_str2int(optarg)) < 0){ + if ((config_dump_format = format_str2int(optarg)) == (enum format_enum)-1){ fprintf(stderr, "Unrecognized dump format: %s(expected: xml|json|text)\n", argv[0]); usage(h, argv[0]); } diff --git a/apps/netconf/netconf_main.c b/apps/netconf/netconf_main.c index 6f39ce36..da027c2c 100644 --- a/apps/netconf/netconf_main.c +++ b/apps/netconf/netconf_main.c @@ -732,9 +732,7 @@ main(int argc, case 'l': /* log */ break; /* see above */ case 'C': /* Explicitly dump configuration */ - if (!strlen(optarg)) - usage(h, argv[0]); - if ((config_dump_format = format_str2int(optarg)) < 0){ + if ((config_dump_format = format_str2int(optarg)) == (enum format_enum)-1){ fprintf(stderr, "Unrecognized dump format: %s(expected: xml|json|text)\n", argv[0]); usage(h, argv[0]); } diff --git a/apps/restconf/restconf_main_fcgi.c b/apps/restconf/restconf_main_fcgi.c index 97058c86..6d60d07e 100644 --- a/apps/restconf/restconf_main_fcgi.c +++ b/apps/restconf/restconf_main_fcgi.c @@ -392,9 +392,7 @@ main(int argc, case 'l': /* log */ break; /* taken care of in earlier getopt above */ case 'C': /* Explicitly dump configuration */ - if (!strlen(optarg)) - usage(h, argv[0]); - if ((config_dump_format = format_str2int(optarg)) < 0){ + if ((config_dump_format = format_str2int(optarg)) == (enum format_enum)-1){ fprintf(stderr, "Unrecognized dump format: %s(expected: xml|json|text)\n", argv[0]); usage(h, argv[0]); } diff --git a/apps/restconf/restconf_main_native.c b/apps/restconf/restconf_main_native.c index c4f71c0a..64090fa7 100644 --- a/apps/restconf/restconf_main_native.c +++ b/apps/restconf/restconf_main_native.c @@ -1241,9 +1241,7 @@ main(int argc, case 'l': /* log */ break; /* see above */ case 'C': /* Explicitly dump configuration */ - if (!strlen(optarg)) - usage(h, argv[0]); - if ((config_dump_format = format_str2int(optarg)) < 0){ + if ((config_dump_format = format_str2int(optarg)) == (enum format_enum)-1){ fprintf(stderr, "Unrecognized dump format: %s(expected: xml|json|text)\n", argv[0]); usage(h, argv[0]); } diff --git a/apps/snmp/snmp_main.c b/apps/snmp/snmp_main.c index 5cfd3980..ea2175dd 100644 --- a/apps/snmp/snmp_main.c +++ b/apps/snmp/snmp_main.c @@ -70,7 +70,7 @@ #include "snmp_register.h" /* Command line options to be passed to getopt(3) */ -#define SNMP_OPTS "hD:f:l:o:z" +#define SNMP_OPTS "hD:f:l:C:o:z" /* Forward */ static int clixon_snmp_input_cb(int s, void *arg); @@ -312,6 +312,7 @@ usage(clicon_handle h, "\t-D \tDebug level (>1 for extensive libnetsnmp debug)\n" "\t-f \tConfiguration file (mandatory)\n" "\t-l (e|o|s|f) Log on std(e)rr, std(o)ut, (s)yslog(default), (f)ile\n" + "\t-C \tDump configuration options on stdout after loading. Format is xml|json|text\n" "\t-z\t\tKill other %s daemon and exit\n" "\t-o \"