#endif
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
#include <pulse/xmalloc.h>
+#include <pulsecore/core-util.h>
#include <pulsecore/ioline.h>
#include <pulsecore/module.h>
-#include <pulsecore/sink.h>
-#include <pulsecore/source.h>
#include <pulsecore/client.h>
-#include <pulsecore/sink-input.h>
-#include <pulsecore/source-output.h>
#include <pulsecore/tokenizer.h>
#include <pulsecore/strbuf.h>
-#include <pulsecore/namereg.h>
#include <pulsecore/cli-text.h>
#include <pulsecore/cli-command.h>
#include <pulsecore/log.h>
pa_bool_t fail, kill_requested;
int defer_kill;
+
+ char *last_line;
};
static void line_callback(pa_ioline *line, const char *s, void *userdata);
c->fail = c->kill_requested = FALSE;
c->defer_kill = 0;
+ c->last_line = NULL;
+
return c;
}
pa_ioline_close(c->line);
pa_ioline_unref(c->line);
pa_client_free(c->client);
+ pa_xfree(c->last_line);
pa_xfree(c);
}
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);