another typo in comment
[paraslash.git] / gui_common.c
1 #include "para.h"
2
3 extern const char *status_item_list[NUM_STAT_ITEMS];
4
5
6 int para_open_audiod_pipe(char *cmd)
7 {
8 int fds[3] = {0, 1, 0};
9 pid_t pid;
10 return para_exec_cmdline_pid(&pid, cmd, fds) > 0?
11 fds[1] : -1;
12 }
13
14 int read_audiod_pipe(int fd, void (*line_handler)(char *) )
15 {
16 static char buf[STRINGSIZE + 1];
17 static ssize_t loaded, bufsize = sizeof(buf);
18 ssize_t ret;
19
20 if (loaded >= bufsize)
21 loaded = 0;
22 ret = read(fd, buf + loaded, bufsize - loaded);
23 if (ret > 0) {
24 loaded += ret;
25 buf[loaded] = '\0';
26 loaded = for_each_line(buf, loaded, line_handler, 0);
27 }
28 return ret;
29 }