(char *)channel_id);
continue;
}
- ch = find_channel(channel_list, channel_target);
+ ch = find_channel(channel_list, channel_target, TRUE);
if (!ch) {
g_printerr("cli: No channel with name \"%s\" found.\n",
(char *)channel_target);
#include <glib.h>
#include "sigrok-cli.h"
-struct sr_channel *find_channel(GSList *channellist, const char *channelname)
+struct sr_channel *find_channel(GSList *channellist, const char *channelname,
+ gboolean exact_case)
{
struct sr_channel *ch;
GSList *l;
ch = NULL;
for (l = channellist; l; l = l->next) {
ch = l->data;
- if (!strcmp(ch->name, channelname))
- break;
+ if (exact_case) {
+ if (strcmp(ch->name, channelname) == 0)
+ break;
+ } else {
+ if (g_ascii_strcasecmp(ch->name, channelname) == 0)
+ break;
+ }
}
ch = l ? l->data : NULL;
ret = SR_ERR;
break;
}
- ch = find_channel(channels, str);
+ ch = find_channel(channels, str, TRUE);
if (!ch) {
g_critical("unknown channel '%d'.", b);
ret = SR_ERR;
break;
}
- ch = find_channel(channels, names[0]);
+ ch = find_channel(channels, names[0], TRUE);
if (!ch) {
g_critical("unknown channel '%s'.", names[0]);
g_strfreev(names);
#endif
/* parsers.c */
-struct sr_channel *find_channel(GSList *channellist, const char *channelname);
+struct sr_channel *find_channel(GSList *channellist, const char *channelname,
+ gboolean exact_case);
GSList *parse_channelstring(struct sr_dev_inst *sdi, const char *channelstring);
int parse_triggerstring(const struct sr_dev_inst *sdi, const char *s,
struct sr_trigger **trigger);