aboutsummaryrefslogtreecommitdiff
path: root/client/client.c
diff options
context:
space:
mode:
authorJanos Kovacs <janos.f.kovacs@nokia.com>2010-01-16 00:41:08 +0200
committerJanos Kovacs <janos.f.kovacs@nokia.com>2010-01-16 00:41:08 +0200
commit4904ef50dd16b68f6eb33999a39e3e71f32436f5 (patch)
tree738f5fb86f225bd01594306651dc352e3ec3f2ca /client/client.c
parent25aff31361aae16fb3de1e98cf2bfe11b8010d63 (diff)
group field in audio stream specification
Diffstat (limited to 'client/client.c')
-rw-r--r--client/client.c59
1 files changed, 39 insertions, 20 deletions
diff --git a/client/client.c b/client/client.c
index 3566b09..1e078fe 100644
--- a/client/client.c
+++ b/client/client.c
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <ctype.h>
#include <fcntl.h>
#include <getopt.h>
#include <libgen.h>
@@ -241,6 +242,7 @@ static void parse_input(void)
char *p;
char *rs;
uint32_t res[4];
+ char *audiogr;
uint32_t pid;
char *name;
char *value;
@@ -302,29 +304,46 @@ static void parse_input(void)
else if (!strncmp(str, "audio", 5)) {
p = skip_whitespaces(str + 5);
- if ((pid = strtoul(p, &p, 10)) != 0 && (*p == ' ' || *p == '\t')) {
+ do {
+ if (!isalpha(p[0])) {
+ print_message("invalid audio group");
+ break;
+ }
+ for (audiogr = p; *p; p++) {
+ if (*p == ' ' || *p == '\t') {
+ *p++ = '\0';
+ p = skip_whitespaces(p);
+ break;
+ }
+ }
+
+ if (!(pid = strtoul(p, &p, 10)) || (*p != ' ' && *p != '\t')) {
+ print_message("invalid pid");
+ break;
+ }
+
name = skip_whitespaces(p);
- if ((p = strchr(name, ':')) == NULL)
+
+ if ((p = strchr(name, ':')) == NULL) {
print_message("invalid property specification: '%s'", name);
- else {
- *p++ = '\0';
- value = p;
- str = strchrnul(value, ' ');
- *str = '\0';
-
- memset(&msg, 0, sizeof(resmsg_t));
- msg.audio.type = RESMSG_AUDIO;
- msg.audio.pid = pid;
- msg.audio.property.name = name;
- msg.audio.property.match.method = resmsg_method_equals;
- msg.audio.property.match.pattern = value;
-
- manager_send_message(&msg);
+ break;
}
- }
- else {
- print_message("invalid pid");
- }
+
+ *p++ = '\0';
+ value = p;
+ str = strchrnul(value, ' ');
+ *str = '\0';
+
+ memset(&msg, 0, sizeof(resmsg_t));
+ msg.audio.type = RESMSG_AUDIO;
+ msg.audio.group = audiogr;
+ msg.audio.pid = pid;
+ msg.audio.property.name = name;
+ msg.audio.property.match.method = resmsg_method_equals;
+ msg.audio.property.match.pattern = value;
+
+ manager_send_message(&msg);
+ } while (0);
}
else {
print_message("invalid input '%s'", input.buf);