diff --git a/src/strfsong.c b/src/strfsong.c
index 22f2e2e6d10d5ca1bc7229e020eab55cfa6d843e..ed3e20f9807ad56fa1c91621a1f551dfd96f879f 100644 (file)
--- a/src/strfsong.c
+++ b/src/strfsong.c
-/*
- * $Id$
- *
+/*
* Based on mpc's songToFormatedString modified for glib and ncmpc
*
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "strfsong.h"
+#include "charset.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <string.h>
-#include <glib.h>
-
-#include "config.h"
-#include "libmpdclient.h"
-#include "support.h"
-#include "strfsong.h"
static const gchar *
skip(const gchar * p)
gint stack = 0;
while (*p != '\0') {
- if(*p == '[') stack++;
- if(*p == '#' && p[1] != '\0') {
+ if (*p == '[')
+ stack++;
+ if (*p == '#' && p[1] != '\0') {
/* skip escaped stuff */
++p;
- } else if(stack) {
+ } else if (stack) {
if(*p == ']') stack--;
} else {
if(*p == '&' || *p == '|' || *p == ']') {
_strfsong(gchar *s,
gsize max,
const gchar *format,
- mpd_Song *song,
+ const struct mpd_song *song,
const gchar **last)
{
const gchar *p, *end;
gboolean found = FALSE;
memset(s, 0, max);
- if( song==NULL )
+ if (song == NULL)
return 0;
for (p = format; *p != '\0' && length<max;) {
if( strstr(song->file, "://") )
temp = utf8_to_locale(song->file);
else
- temp = utf8_to_locale(basename(song->file));
+ temp = utf8_to_locale(g_basename(song->file));
} else if (strncmp("%time%", p, n) == 0) {
if (song->time != MPD_SONG_NO_TIME) {
if (song->time > 3600) {
}
gsize
-strfsong(gchar *s, gsize max, const gchar *format, mpd_Song *song)
+strfsong(gchar *s, gsize max, const gchar *format,
+ const struct mpd_song *song)
{
- return _strfsong(s, max, format, song, NULL);
+ return _strfsong(s, max, format, song, NULL);
}
-
+