]> code.delx.au - pulseaudio/blob - src/protocol-native-unix.c
mofiy keyword expansion
[pulseaudio] / src / protocol-native-unix.c
1 #include "module.h"
2
3 int module_init(struct core *c, struct module*m) {
4 struct fn[PATH_MAX];
5 struct socket_server *s;
6 char *t;
7 assert(c && m);
8
9 if (!(t = getenv("TMP")))
10 if (!(t = getenv("TEMP")))
11 t = "/tmp";
12
13 snprintf(fn, sizeof(fn), "%s/foosock", t);
14
15 if (!(s = socket_server_new_unix(c->mainloop, fn)))
16 return -1;
17
18 m->userdata = protocol_native_new(s);
19 assert(m->userdata);
20 return 0;
21 }
22
23 void module_done(struct core *c, struct module*m) {
24 assert(c && m);
25
26 protocol_native_free(m->userdata);
27 }