summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmpdemux/cue_read.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/libmpdemux/cue_read.c b/libmpdemux/cue_read.c
index e76787820b..553684e9ac 100644
--- a/libmpdemux/cue_read.c
+++ b/libmpdemux/cue_read.c
@@ -8,7 +8,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
-//#include <libgen.h>
#include "config.h"
#include "mp_msg.h"
@@ -33,9 +32,6 @@
#define MODE2_2336 40
#define UNKNOWN -1
-// from libgen:
-extern char *dirname(char *path);
-
static FILE* fd_cue;
static int fd_bin = 0;
@@ -293,7 +289,15 @@ int cue_read_cue (char *in_cue_filename)
/* split the filename into a path and filename part */
s = strdup(in_cue_filename);
- t = dirname(s);
+ t = strrchr(s, '/');
+ if (t == (char *)NULL)
+ t = ".";
+ else {
+ *t = '\0';
+ t = s;
+ if (*t)
+ strcpy(t, "/");
+ }
printf ("dirname: %s\n", t);
strcpy(bincue_path,t);