]> sigrok.org Git - sigrok-cli.git/commitdiff
show: Format channel output when no channel is available
authorFrank Stettner <redacted>
Sun, 15 Aug 2021 16:30:03 +0000 (18:30 +0200)
committerFrank Stettner <redacted>
Sun, 15 Aug 2021 16:30:03 +0000 (18:30 +0200)
show.c

diff --git a/show.c b/show.c
index 9ce35b4a61b4360e39dcc03cbc6c985371a580bb..5243e53cc07aad1817b37cbd2bb2132a57ce83ac 100644 (file)
--- a/show.c
+++ b/show.c
@@ -465,8 +465,11 @@ void show_dev_detail(void)
                printf("Channel groups:\n");
                for (cgl = channel_groups; cgl; cgl = cgl->next) {
                        cg = cgl->data;
-                       printf("    %s: channel%s", cg->name,
-                                       g_slist_length(cg->channels) > 1 ? "s" : "");
+                       printf("    %s: ", cg->name);
+                       if (g_slist_length(cg->channels) == 0)
+                               printf("No channels");
+                       else
+                               printf("channel%s", g_slist_length(cg->channels) > 1 ? "s" : "");
                        for (chl = cg->channels; chl; chl = chl->next) {
                                ch = chl->data;
                                printf(" %s", ch->name);