- /*
- * Caller requested "<id>[:<key>=<val>]*" case, Consume the
- * first item, before processing more key-value pairs below.
- */
- g_hash_table_insert(hash, g_strdup("sigrok_key"),
- g_strdup(elements[i++]));
- } else if (key_first && *key_first) {
- /*
- * Caller requested "[<sig>=<id>][:<key>=<val>]*" case.
- * Optional special handling of the first item, but only
- * consume this first item here when its keyword matched
- * the caller's specification.
- */
- l = strlen(key_first);
- s = elements[i];
- e = strchr(s, '=');
- if (e && e - s == l && g_str_has_prefix(s, key_first)) {
- g_hash_table_insert(hash,
- g_strdup("sigrok_key"), g_strdup(++e));
- i++;
+ k = g_strdup("sigrok_key");
+ v = g_strdup(elements[i++]);
+ g_hash_table_insert(hash, k, v);
+ } else if (key_first) {
+ split_key_value(elements[i], &k, &v);
+ if (g_ascii_strcasecmp(k, key_first) == 0) {
+ k = "sigrok_key";