Better output module checking.
authorBert Vermeulen <bert@biot.com>
Sat, 2 Aug 2014 23:19:55 +0000 (01:19 +0200)
committerBert Vermeulen <bert@biot.com>
Sat, 2 Aug 2014 23:19:55 +0000 (01:19 +0200)
session.c
show.c

index 46bb4d9676967027b9b984e2ccf23f09c600e044..39eb164942c447a57bba67e04ad3e9e7d7fee06a 100644 (file)
--- a/session.c
+++ b/session.c
@@ -174,7 +174,8 @@ void datafeed_in(const struct sr_dev_inst *sdi,
        switch (packet->type) {
        case SR_DF_HEADER:
                g_debug("cli: Received SR_DF_HEADER.");
-               o = setup_output_format(sdi);
+               if (!(o = setup_output_format(sdi)))
+                       g_critical("Failed to initialize output module.");
 
                /* Set up backup analog output module. */
                oa = sr_output_new(sr_output_find("analog"), NULL, sdi);
diff --git a/show.c b/show.c
index 817a65fd43e91f02db468f4b97b56eb9a3efbfa4..4c0cd8f6737667e3322307f3173da232f63ac1a4 100644 (file)
--- a/show.c
+++ b/show.c
@@ -649,9 +649,10 @@ void show_output(void)
        const struct sr_output_module *omod;
        const struct sr_option *opt;
        GSList *l;
-       char *s;
+       char *s, **tok;
 
-       if (!(omod = sr_output_find(opt_output_format)))
+       tok = g_strsplit(opt_output_format, ":", 0);
+       if (!tok[0] || !(omod = sr_output_find(tok[0])))
                g_critical("Output module '%s' not found.", opt_output_format);
 
        printf("ID: %s\nName: %s\n", sr_output_id_get(omod),
@@ -680,5 +681,6 @@ void show_output(void)
                }
                sr_output_options_free(omod);
        }
+       g_strfreev(tok);
 }