From 73926ef5e5dbe1a3bfd627a016c3a975cf673327 Mon Sep 17 00:00:00 2001 From: Robert Hak Date: Thu, 17 Oct 2002 09:34:48 +0000 Subject: %pn now allows for conditional checking git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2698 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'apps/playlist.c') diff --git a/apps/playlist.c b/apps/playlist.c index 3cd40deb45..ce812c7c67 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -111,18 +111,21 @@ int playlist_first_index(void) return playlist.first_index; } -void playlist_name(char *name, int name_size) +char *playlist_name(char *buf, int buf_size) { - char buf[MAX_PATH+1]; - int i = 0; + char *sep; + + snprintf(buf, buf_size, "%s", playlist.filename+playlist.dirlen); - snprintf(buf, sizeof(buf), "%s", playlist.filename+playlist.dirlen); - while((buf[i] != '.') && (buf[i] != 0)) - i++; - buf[i] = 0; + if (0 == buf[0]) + return NULL; - snprintf(name, name_size, "%s", buf); - return; + /* Remove extension */ + sep = strrchr(buf, '.'); + if (NULL != sep) + *sep = 0; + + return buf; } int playlist_next(int steps) -- cgit v1.2.3