Lines Matching defs:value
59 char *value;
104 free(pair->value);
147 static int value_set(struct space *space, const char *key, const char *value)
153 free(pair->value);
154 pair->value = strdup(value);
155 if (pair->value == NULL)
166 pair->value = strdup(value);
167 if (pair->value == NULL) {
340 static int set_ctl_value(struct space *space, const char *value, int all)
354 while (*value == ' ')
355 value++;
356 if (*value == '\0')
358 val = strncasecmp(value, "true", 4) == 0 ||
359 strncasecmp(value, "yes", 3) == 0 ||
360 strncasecmp(value, "on", 2) == 0 ||
361 strncasecmp(value, "1", 1) == 0;
365 pos = strchr(value, ',');
366 value = pos ? pos + 1 : value + strlen(value) - 1;
371 while (*value == ' ')
372 value++;
373 pos = strchr(value, ',');
376 remove_trailing_chars((char *)value, ' ');
377 items = pos ? (unsigned)(pos - value) : (unsigned)strlen(value);
378 if (items > 1 && value[items-1] == '%') {
379 val = convert_prange1(strtol(value, NULL, 0), snd_ctl_elem_info_get_min(space->ctl_info), snd_ctl_elem_info_get_max(space->ctl_info));
381 } else if (items > 2 && value[items-2] == 'd' && value[items-1] == 'B') {
382 val = strtol(value, NULL, 0) * 100;
383 if ((pos2 = strchr(value, '.')) != NULL) {
398 dbg("unable to convert dB value '%s' to internal integer range", value);
403 snd_ctl_elem_value_set_integer(space->ctl_value, idx, strtol(value, NULL, 0));
407 value = pos ? pos + 1 : value + strlen(value) - 1;
412 while (*value == ' ')
413 value++;
414 snd_ctl_elem_value_set_integer64(space->ctl_value, idx, strtoll(value, NULL, 0));
417 pos = strchr(value, ',');
418 value = pos ? pos + 1 : value + strlen(value) - 1;
423 while (*value == ' ')
424 value++;
425 pos = strchr(value, ',');
426 if (isdigit(value[0]) || value[0] == '-') {
427 snd_ctl_elem_value_set_enumerated(space->ctl_value, idx, strtol(value, NULL, 0));
431 remove_trailing_chars((char *)value, ' ');
441 if (strcasecmp(snd_ctl_elem_info_get_item_name(space->ctl_info), value) == 0) {
447 Perror(space, "wrong enum identifier '%s'", value);
453 value = pos ? pos + 1 : value + strlen(value) - 1;
460 while (*value == ' ')
461 value++;
462 if (strlen(value) != count * 2) {
463 Perror(space, "bad ctl value hexa length (should be %u bytes)", count);
467 int nibble1 = hextodigit(*(value++));
468 int nibble2 = hextodigit(*(value++));
470 Perror(space, "bad ctl hexa value");
488 const char *key_value, const char *value)
492 if (value == NULL)
494 dbg("match %s '%s' <-> '%s'", key, key_value, value);
495 match = fnmatch(key_value, value, 0) == 0;
497 dbg("%s is true (matching value)", key);
501 dbg("%s is true (non-matching value)", key);
535 goto value;
542 goto value;
546 goto value;
552 goto value;
589 goto value;
595 goto value;
607 goto value;
619 goto value;
631 goto value;
643 goto value;
645 if (strncasecmp(attr, "value", 5) == 0) {
743 value:
748 static int elemid_set(struct space *space, const char *attr, const char *value)
757 goto value;
763 if (strlen(value) == 0 && strncasecmp(attr, "search", 6) == 0) {
768 if (strcasecmp(value, snd_ctl_elem_iface_name(iface)) == 0) {
780 if (strlen(value) == 0)
788 Perror(space, "unknown control interface name '%s'", value);
793 goto value;
797 goto value;
800 snd_ctl_elem_id_set_name(space->ctl_id, value);
806 goto value;
809 strncasecmp(attr, "value", 5) == 0) {
815 err = set_ctl_value(space, value, strncasecmp(attr, "values", 6) == 0);
823 Perror(space, "value write error: %s", snd_strerror(err));
831 value:
832 val = (unsigned int)strtol(value, NULL, 0);
838 static int get_key(char **line, char **key, enum key_op *op, char **value)
915 /* get the value*/
919 *value = linepos;
933 dbg("value='%s'", *value);
1098 const char *value = cardinfo_get(space, attr);
1099 if (value == NULL)
1101 strlcat(string, value, maxsize);
1102 dbg("substitute cardinfo{%s} '%s'", attr, value);
1109 const char *value = elemid_get(space, attr);
1110 if (value == NULL)
1112 strlcat(string, value, maxsize);
1113 dbg("substitute ctl{%s} '%s'", attr, value);
1154 const char *value = NULL;
1160 value = sysfs_attr_get_value(pair->value, attr);
1162 if (value == NULL)
1165 /* strip trailing whitespace and replace untrusted characters of sysfs value */
1166 size = strlcpy(temp2, value, sizeof(temp2));
1175 dbg("substitute sysfs value '%s'", temp2);
1203 strlcat(string, pair->value, maxsize);
1291 char *key, *value, *attr, *temp;
1302 err = get_key(&linepos, &key, &op, &value);
1311 if (space->go_to && strcmp(space->go_to, value) == 0) {
1330 strlcpy(result, value, sizeof(result));
1332 dbg("ctl assign: '%s' '%s'", value, attr);
1345 strlcpy(result, value, sizeof(result));
1347 dbg("ctl write: '%s' '%s'", value, attr);
1355 dbg("ctl match: '%s' '%s' '%s'", attr, value, temp);
1356 if (!do_match(key, op, value, temp))
1367 if (!do_match(key, op, value, space->program_result))
1374 strlcpy(string, value, sizeof(string));
1388 strlcpy(string, value, sizeof(string));
1421 dbg("cardinfo: '%s' '%s'", value, attr);
1423 if (!do_match(key, op, value, temp))
1441 dbg("sysfs_attr: '%s' '%s'", pair->value, attr);
1442 temp = sysfs_attr_get_value(pair->value, attr);
1443 if (!do_match(key, op, value, temp))
1460 if (!do_match(key, op, value, temp))
1464 strlcpy(result, value, sizeof(result));
1480 space->go_to = strdup(value);
1496 if (value[0] == '/')
1497 strlcpy(string, value, sizeof(string));
1501 strlcat(string, value, sizeof(string));
1566 if (value[0] == '$') {
1567 strlcpy(string, value, sizeof(string));
1572 if (value[0] != '/') {
1575 strlcat(string, value, sizeof(string));
1577 strlcpy(string, value, sizeof(string));
1582 dbg("access(%s) = %i (%s)", string, count, value);
1598 strlcpy(string, value, sizeof(string));
1608 strlcpy(string, value, sizeof(string));
1618 strlcpy(string, value, sizeof(string));
1632 strlcpy(result, value, sizeof(result));
1642 if (!do_match(key, op, result, pair->value))