diff options
| -rw-r--r-- | src/pulsecore/cli.c | 13 | 
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pulsecore/cli.c b/src/pulsecore/cli.c index a784f583..54514e7f 100644 --- a/src/pulsecore/cli.c +++ b/src/pulsecore/cli.c @@ -59,6 +59,8 @@ struct pa_cli {      pa_bool_t fail, kill_requested;      int defer_kill; + +    char *last_line;  };  static void line_callback(pa_ioline *line, const char *s, void *userdata); @@ -101,6 +103,8 @@ pa_cli* pa_cli_new(pa_core *core, pa_iochannel *io, pa_module *m) {      c->fail = c->kill_requested = FALSE;      c->defer_kill = 0; +    c->last_line = NULL; +      return c;  } @@ -110,6 +114,7 @@ void pa_cli_free(pa_cli *c) {      pa_ioline_close(c->line);      pa_ioline_unref(c->line);      pa_client_free(c->client); +    pa_xfree(c->last_line);      pa_xfree(c);  } @@ -144,6 +149,14 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) {          return;      } +    /* Magic command, like they had in AT Hayes Modems! Those were the good days! */ +    if (pa_streq(s, "/")) +        s = c->last_line; +    else if (s[0]) { +        pa_xfree(c->last_line); +        c->last_line = pa_xstrdup(s); +    } +      pa_assert_se(buf = pa_strbuf_new());      c->defer_kill++;      pa_cli_command_execute_line(c->core, s, buf, &c->fail);  | 
