]> sigrok.org Git - sigrok-cli.git/blobdiff - session.c
parsers: rephrase option key/value parsing some more
[sigrok-cli.git] / session.c
index cb8a1b4f27ab742f796d46a7e9cc2e47c40088c9..56a4d25e30bb050a2feaccc06e526b41dedd7268 100644 (file)
--- a/session.c
+++ b/session.c
@@ -92,7 +92,7 @@ const struct sr_output *setup_output_format(const struct sr_dev_inst *sdi, FILE
                }
        }
 
-       fmtargs = parse_generic_arg(opt_output_format, TRUE);
+       fmtargs = parse_generic_arg(opt_output_format, TRUE, NULL);
        fmtspec = g_hash_table_lookup(fmtargs, "sigrok_key");
        if (!fmtspec)
                g_critical("Invalid output format.");
@@ -101,9 +101,11 @@ const struct sr_output *setup_output_format(const struct sr_dev_inst *sdi, FILE
        g_hash_table_remove(fmtargs, "sigrok_key");
        if ((options = sr_output_options_get(omod))) {
                fmtopts = generic_arg_to_opt(options, fmtargs);
+               (void)warn_unknown_keys(options, fmtargs, NULL);
                sr_output_options_free(options);
-       } else
+       } else {
                fmtopts = NULL;
+       }
        o = sr_output_new(omod, fmtopts, sdi, opt_output_file);
 
        if (opt_output_file) {
@@ -136,7 +138,7 @@ const struct sr_transform *setup_transform_module(const struct sr_dev_inst *sdi)
        GHashTable *fmtargs, *fmtopts;
        char *fmtspec;
 
-       fmtargs = parse_generic_arg(opt_transform_module, TRUE);
+       fmtargs = parse_generic_arg(opt_transform_module, TRUE, NULL);
        fmtspec = g_hash_table_lookup(fmtargs, "sigrok_key");
        if (!fmtspec)
                g_critical("Invalid transform module.");
@@ -145,9 +147,11 @@ const struct sr_transform *setup_transform_module(const struct sr_dev_inst *sdi)
        g_hash_table_remove(fmtargs, "sigrok_key");
        if ((options = sr_transform_options_get(tmod))) {
                fmtopts = generic_arg_to_opt(options, fmtargs);
+               (void)warn_unknown_keys(options, fmtargs, NULL);
                sr_transform_options_free(options);
-       } else
+       } else {
                fmtopts = NULL;
+       }
        t = sr_transform_new(tmod, fmtopts, sdi);
        if (fmtopts)
                g_hash_table_destroy(fmtopts);
@@ -762,7 +766,7 @@ void run_session(void)
        }
 
        if (opt_config) {
-               if ((devargs = parse_generic_arg(opt_config, FALSE))) {
+               if ((devargs = parse_generic_arg(opt_config, FALSE, NULL))) {
                        if (set_dev_options(sdi, devargs) != SR_OK)
                                return;
                        g_hash_table_destroy(devargs);