Fix an off-by-one bug.
[paraslash.git] / gui_common.c
index 26c3d61b73feacd5b77d45e86767944ef5680564..dc3450a8410b3002e6a4e41f0a548d2f8efd8e9f 100644 (file)
@@ -1,4 +1,17 @@
+/*
+ * Copyright (C) 2006-2007 Andre Noll <maan@systemlinux.org>
+ *
+ * Licensed under the GPL v2. For licencing details see COPYING.
+ */
+
+/** \file gui_common.c Functions used by the guis of paraslash. */
+
+
+#include <sys/types.h>
+#include <dirent.h>
+
 #include "para.h"
+#include "string.h"
 #include "fd.h"
 
 extern const char *status_item_list[NUM_STAT_ITEMS];
@@ -17,7 +30,7 @@ int para_open_audiod_pipe(char *cmd)
        return ret;
 }
 
-int read_audiod_pipe(int fd, void (*line_handler)(char *) )
+int read_audiod_pipe(int fd, line_handler_t *line_handler)
 {
        static char buf[4096];
        const ssize_t bufsize = sizeof(buf) - 1;
@@ -30,7 +43,7 @@ int read_audiod_pipe(int fd, void (*line_handler)(char *) )
        if (ret > 0) {
                loaded += ret;
                buf[loaded] = '\0';
-               loaded = for_each_line(buf, loaded, line_handler);
+               loaded = for_each_line(buf, loaded, line_handler, NULL);
        }
        return ret;
 }