return probelist;
}
-GHashTable *parse_generic_arg(const char *arg)
+GHashTable *parse_generic_arg(const char *arg, gboolean sep_first)
{
GHashTable *hash;
int i;
if (!arg || !arg[0])
return NULL;
- hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
+ i = 0;
+ hash = g_hash_table_new_full(g_str_hash, g_str_equal,
+ g_free, g_free);
elements = g_strsplit(arg, ":", 0);
- g_hash_table_insert(hash, g_strdup("sigrok_key"), g_strdup(elements[0]));
- for (i = 1; elements[i]; i++) {
+ if (sep_first)
+ g_hash_table_insert(hash, g_strdup("sigrok_key"),
+ g_strdup(elements[i++]));
+ for (; elements[i]; i++) {
e = strchr(elements[i], '=');
if (!e)
g_hash_table_insert(hash, g_strdup(elements[i]), NULL);
pd_opthash = NULL;
pdtokens = g_strsplit(pdstring, ",", 0);
for (pdtok = pdtokens; *pdtok; pdtok++) {
- if (!(pd_opthash = parse_generic_arg(*pdtok))) {
+ if (!(pd_opthash = parse_generic_arg(*pdtok, TRUE))) {
g_critical("Invalid protocol decoder option '%s'.", *pdtok);
goto err_out;
}
default_output_format = TRUE;
}
- fmtargs = parse_generic_arg(opt_output_format);
+ fmtargs = parse_generic_arg(opt_output_format, TRUE);
fmtspec = g_hash_table_lookup(fmtargs, "sigrok_key");
if (!fmtspec) {
g_critical("Invalid output format.");
/* parsers.c */
char **parse_probestring(int max_probes, const char *probestring);
char **sr_parse_triggerstring(struct sr_dev *dev, const char *triggerstring);
-GHashTable *parse_generic_arg(const char *arg);
+GHashTable *parse_generic_arg(const char *arg, gboolean sep_first);
struct sr_dev *parse_devstring(const char *devstring);
uint64_t sr_parse_timestring(const char *timestring);
char *strcanon(const char *str);