2 * Copyright (C) 2006-2007 Andre Noll <maan@systemlinux.org>
4 * Licensed under the GPL v2. For licencing details see COPYING.
7 /** \file gui_common.c Functions used by the guis of paraslash. */
10 #include <sys/types.h>
17 int para_open_audiod_pipe(char *cmd)
19 int fds[3] = {0, 1, 0};
21 int ret = para_exec_cmdline_pid(&pid, cmd, fds);
24 ret = mark_fd_nonblocking(fds[1]);
31 int read_audiod_pipe(int fd, line_handler_t *line_handler)
33 static char buf[4096];
34 const ssize_t bufsize = sizeof(buf) - 1;
35 static ssize_t loaded;
38 if (loaded >= bufsize)
40 ret = read(fd, buf + loaded, bufsize - loaded);
44 loaded = for_each_line(buf, loaded, line_handler, NULL);