diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-06-18 00:22:37 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-06-18 00:22:37 +0000 |
commit | 993d1bce74f4cc5be2bfa69a467aae106e2194ab (patch) | |
tree | f281667fdbc6f643f4a799be75dcbd95102c0dc8 /src/client.c | |
parent | eb946dbdbeda66b95039b1e5ada3b9006dc33c8c (diff) |
basic cli interface
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@22 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/client.c')
-rw-r--r-- | src/client.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/client.c b/src/client.c index 1b84c6bf..4c8a0491 100644 --- a/src/client.c +++ b/src/client.c @@ -4,6 +4,7 @@ #include <string.h> #include "client.h" +#include "strbuf.h" struct client *client_new(struct core *core, const char *protocol_name, char *name) { struct client *c; @@ -42,3 +43,20 @@ void client_kill(struct client *c) { c->kill(c); } +char *client_list_to_string(struct core *c) { + struct strbuf *s; + struct client *client; + uint32_t index = IDXSET_INVALID; + assert(c); + + s = strbuf_new(); + assert(s); + + strbuf_printf(s, "%u client(s).\n", idxset_ncontents(c->clients)); + + for (client = idxset_first(c->clients, &index); client; client = idxset_next(c->clients, &index)) + strbuf_printf(s, " index: %u, name: <%s>, protocol_name: <%s>\n", client->index, client->name, client->protocol_name); + + return strbuf_tostring_free(s); +} + |