blob: df3b9f1276116313f53e0a9c3763773d53a0e8a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#include <stdlib.h>
#include <glib.h>
#include "config.h"
#include "plugin.h"
#include "speech.h"
struct speech_priv {
char *cmdline;
};
static int
speechd_say(struct speech_priv *this, const char *text)
{
char *cmdline;
cmdline=g_strdup_printf(this->cmdline, text);
return system(cmdline);
}
static void
speechd_destroy(struct speech_priv *this) {
g_free(this->cmdline);
g_free(this);
}
static struct speech_methods speechd_meth = {
speechd_destroy,
speechd_say,
};
static struct speech_priv *
speechd_new(char *data, struct speech_methods *meth) {
struct speech_priv *this;
if (! data)
return NULL;
this=g_new(struct speech_priv,1);
this->cmdline=g_strdup(data);
*meth=speechd_meth;
return this;
}
void
plugin_init(void)
{
plugin_register_speech_type("cmdline", speechd_new);
}
|