summaryrefslogtreecommitdiffstats
path: root/src/cli.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-06-23 23:17:30 +0000
committerLennart Poettering <lennart@poettering.net>2004-06-23 23:17:30 +0000
commitacb25b35102dfca08f66e155560f6c99cb8fa841 (patch)
tree2ae84c77727548a15eabbe5ad624dc1fd29af30b /src/cli.c
parenteecf602476ff5b51bdc08f8fd0e4aa70d2b0ef5a (diff)
main part of the native protocol
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@31 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/cli.c')
-rw-r--r--src/cli.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/cli.c b/src/cli.c
index ec484ace..09162351 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -20,6 +20,8 @@ struct cli {
void (*eof_callback)(struct cli *c, void *userdata);
void *userdata;
+
+ struct client *client;
};
struct command {
@@ -63,6 +65,7 @@ static const struct command commands[] = {
static const char prompt[] = ">>> ";
struct cli* cli_new(struct core *core, struct iochannel *io) {
+ char cname[256];
struct cli *c;
assert(io);
@@ -75,16 +78,21 @@ struct cli* cli_new(struct core *core, struct iochannel *io) {
c->userdata = NULL;
c->eof_callback = NULL;
+ iochannel_peer_to_string(io, cname, sizeof(cname));
+ c->client = client_new(core, "CLI", cname);
+ assert(c->client);
+
ioline_set_callback(c->line, line_callback, c);
ioline_puts(c->line, "Welcome to polypaudio! Use \"help\" for usage information.\n");
ioline_puts(c->line, prompt);
-
+
return c;
}
void cli_free(struct cli *c) {
assert(c);
ioline_free(c->line);
+ client_free(c->client);
free(c);
}
@@ -135,7 +143,7 @@ void cli_set_eof_callback(struct cli *c, void (*cb)(struct cli*c, void *userdata
static void cli_command_exit(struct cli *c, struct tokenizer *t) {
assert(c && c->core && c->core->mainloop && t);
- mainloop_quit(c->core->mainloop, -1);
+ c->core->mainloop->quit(c->core->mainloop, 0);
}
static void cli_command_help(struct cli *c, struct tokenizer *t) {