dc3450a8410b3002e6a4e41f0a548d2f8efd8e9f
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 extern const char *status_item_list
[NUM_STAT_ITEMS
];
19 int para_open_audiod_pipe(char *cmd
)
21 int fds
[3] = {0, 1, 0};
23 int ret
= para_exec_cmdline_pid(&pid
, cmd
, fds
);
26 ret
= mark_fd_nonblock(fds
[1]);
33 int read_audiod_pipe(int fd
, line_handler_t
*line_handler
)
35 static char buf
[4096];
36 const ssize_t bufsize
= sizeof(buf
) - 1;
37 static ssize_t loaded
;
40 if (loaded
>= bufsize
)
42 ret
= read(fd
, buf
+ loaded
, bufsize
- loaded
);
46 loaded
= for_each_line(buf
, loaded
, line_handler
, NULL
);