From c0a444d794fdf85c7b45db3565841e0ba5dde6d1 Mon Sep 17 00:00:00 2001
From: Led <led@altlinux.org>
Date: Mon, 10 Nov 2008 03:48:55 +0200
Subject: [PATCH] 0.9.3-rc1

---
 AUTHORS                |   5 +
 ChangeLog              |  10 +
 Makefile.in            |  10 +-
 UPGRADING              |  12 +-
 aclocal.m4             | 180 +++++++++
 compile                |  99 +++++
 config.guess           |  20 +-
 config.sub             |  11 +-
 configure              | 531 ++++++++++++++++++++++++--
 configure.in           |  13 +-
 debian/Makefile.am     |   3 +-
 debian/Makefile.in     |   7 +-
 debian/changelog       |  12 +-
 debian/conffiles       |   1 +
 debian/config          |  20 +
 debian/control         |   6 +-
 debian/init            |  35 ++
 debian/postinst        |  45 +++
 debian/postrm          |  18 +
 debian/prerm           |  11 +
 debian/rules           | 117 +-----
 debian/templates       |  25 ++
 doc/COMMANDS           |   1 +
 doc/Makefile.in        |   3 +
 doc/mpd.1              |   3 +-
 install-sh             |  36 +-
 mkinstalldirs          |  73 +---
 src/Makefile.am        |   7 +-
 src/Makefile.in        | 677 +++++++++++++++++++++++++++++++---
 src/audiofile_decode.c | 131 +++++++
 src/audiofile_decode.h |  32 ++
 src/char_conv.c        |  99 +++++
 src/char_conv.h        |  28 ++
 src/command.c          | 818 ++++++++++++++++++++---------------------
 src/decode.c           |  14 +-
 src/decode.h           |   1 +
 src/directory.c        |  39 +-
 src/flac_decode.c      |   3 +-
 src/interface.c        | 138 +++++--
 src/ls.c               |  70 +++-
 src/ls.h               |   2 +
 src/main.c             |  51 ++-
 src/mp3_decode.c       |  21 +-
 src/mp3_decode.h       |   7 +
 src/ogg_decode.c       |   8 +-
 src/player.c           |  14 +-
 src/player.h           |   3 +
 src/playerData.h       |   1 +
 src/playlist.c         |  75 ++--
 src/playlist.h         |   2 +
 src/song.c             |  34 +-
 src/tables.c           |   2 +-
 src/tag.c              | 234 ++++++++----
 src/tag.h              |  17 +-
 54 files changed, 2920 insertions(+), 915 deletions(-)
 create mode 100644 AUTHORS
 create mode 100755 compile
 create mode 100644 debian/conffiles
 create mode 100644 debian/config
 create mode 100644 debian/init
 create mode 100644 debian/postinst
 create mode 100644 debian/postrm
 create mode 100644 debian/prerm
 create mode 100644 debian/templates
 create mode 100644 src/audiofile_decode.c
 create mode 100644 src/audiofile_decode.h
 create mode 100644 src/char_conv.c
 create mode 100644 src/char_conv.h

diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 000000000..270ae1da7
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,5 @@
+Developer -> Warren Dukes <shank@mercury.chem.pitt.edu>
+Developer -> tw-nym
+wave File Support -> normalperson
+setuid patch -> Nagilum
+'next' and 'previous' patch -> Niklas Hofer
diff --git a/ChangeLog b/ChangeLog
index 09a725ea2..667b4ba1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+ver 0.9.3 (2003/10/31)
+1) Store total time/length of songs in db and display in *info commands
+2) Display instantaneous bitrate in status command
+3) Add Wave Support using libaudiofile (Patch from normalperson)
+4) Command code cleanup (Patch from tw-nym)
+5) Optimize listing of playlists (10-100x faster)
+6) Optimize interface output (write in 4kB chunks instead of on every '\n')
+7) Fix bug that prevented rm command from working
+8) Fix bug where deleting current song skips the next song
+
 ver 0.9.2 (2003/10/6)
 1) Fix FreeBSD Compilation Problems
 2) Fix bug in move command
diff --git a/Makefile.in b/Makefile.in
index 64ac4b1c6..6f3fc9442 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -70,6 +70,9 @@ AO_CFLAGS = @AO_CFLAGS@
 AO_LIBS = @AO_LIBS@
 AR = @AR@
 AS = @AS@
+AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@
+AUDIOFILE_CONFIG = @AUDIOFILE_CONFIG@
+AUDIOFILE_LIBS = @AUDIOFILE_LIBS@
 AWK = @AWK@
 CC = @CC@
 CCAS = @CCAS@
@@ -125,9 +128,10 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
 	uninstall-info-recursive all-recursive install-data-recursive \
 	install-exec-recursive installdirs-recursive install-recursive \
 	uninstall-recursive check-recursive installcheck-recursive
-DIST_COMMON = README COPYING ChangeLog INSTALL Makefile.am Makefile.in \
-	TODO aclocal.m4 config.guess config.sub configure configure.in \
-	depcomp install-sh ltmain.sh missing mkinstalldirs
+DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
+	Makefile.in TODO aclocal.m4 compile config.guess config.sub \
+	configure configure.in depcomp install-sh ltmain.sh missing \
+	mkinstalldirs
 DIST_SUBDIRS = $(SUBDIRS)
 all: all-recursive
 
diff --git a/UPGRADING b/UPGRADING
index ddbd3ae58..78ede45ee 100644
--- a/UPGRADING
+++ b/UPGRADING
@@ -1,6 +1,16 @@
                        Music Player Daemon (MPD) - UPGRADING
 
-Upgrading to 0.9.x
+Upgrading to 0.9.3
+------------------
+
+Wave support was added, so to have your wave files added, update the db (mpc
+update).  
+
+Also, song lengths are now stored in the db.  To get this stuff
+added to the db, you will need to recreate the db from scratch.  To do this,
+run mpd with the "--create-db" commandline option. 
+
+Upgrading to 0.9.0
 ------------------
 
 The "stop_on_error" config parameter was removed, so be sure to remove this
diff --git a/aclocal.m4 b/aclocal.m4
index 2352fbbe6..ebcf8c5ed 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -7116,3 +7116,183 @@ int main ()
   rm -f conf.libFLACtest
 ])
 
+# Configure paths for the Audio File Library
+# Bertrand Guiheneuf 98-10-21
+# stolen from esd.m4 in esound :
+# Manish Singh    98-9-30
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl AM_PATH_AUDIOFILE([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for Audio File Library, and define AUDIOFILE_CFLAGS and AUDIOFILE_LIBS.
+dnl
+AC_DEFUN(AM_PATH_AUDIOFILE,
+[dnl 
+dnl Get compiler flags and libraries from the audiofile-config script.
+dnl
+AC_ARG_WITH(audiofile-prefix,[  --with-audiofile-prefix=PFX   Prefix where Audio File Library is installed (optional)],
+            audiofile_prefix="$withval", audiofile_prefix="")
+AC_ARG_WITH(audiofile-exec-prefix,[  --with-audiofile-exec-prefix=PFX Exec prefix where Audio File Library is installed (optional)],
+            audiofile_exec_prefix="$withval", audiofile_exec_prefix="")
+AC_ARG_ENABLE(audiofiletest, [  --disable-audiofiletest       Do not try to compile and run a test Audio File Library program], , enable_audiofiletest=yes)
+
+  if test x$audiofile_exec_prefix != x ; then
+     audiofile_args="$audiofile_args --exec-prefix=$audiofile_exec_prefix"
+     if test x${AUDIOFILE_CONFIG+set} != xset ; then
+        AUDIOFILE_CONFIG=$audiofile_exec_prefix/bin/audiofile-config
+     fi
+  fi
+  if test x$audiofile_prefix != x ; then
+     audiofile_args="$audiofile_args --prefix=$audiofile_prefix"
+     if test x${AUDIOFILE_CONFIG+set} != xset ; then
+        AUDIOFILE_CONFIG=$audiofile_prefix/bin/audiofile-config
+     fi
+  fi
+
+  AC_PATH_PROG(AUDIOFILE_CONFIG, audiofile-config, no)
+  min_audiofile_version=ifelse([$1], ,0.2.5,$1)
+  AC_MSG_CHECKING(for Audio File Library - version >= $min_audiofile_version)
+  no_audiofile=""
+  if test "$AUDIOFILE_CONFIG" = "no" ; then
+    no_audiofile=yes
+  else
+    AUDIOFILE_LIBS=`$AUDIOFILE_CONFIG $audiofileconf_args --libs`
+    AUDIOFILE_CFLAGS=`$AUDIOFILE_CONFIG $audiofileconf_args --cflags`
+    audiofile_major_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    audiofile_minor_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    audiofile_micro_version=`$AUDIOFILE_CONFIG $audiofile_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_audiofiletest" = "xyes" ; then
+      AC_LANG_SAVE
+      AC_LANG_C
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
+      LIBS="$LIBS $AUDIOFILE_LIBS"
+dnl
+dnl Now check if the installed Audio File Library is sufficiently new. 
+dnl (Also checks the sanity of the results of audiofile-config to some extent.)
+dnl
+      rm -f conf.audiofiletest
+      AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <audiofile.h>
+
+char*
+my_strdup (char *str)
+{
+  char *new_str;
+  
+  if (str)
+    {
+      new_str = malloc ((strlen (str) + 1) * sizeof(char));
+      strcpy (new_str, str);
+    }
+  else
+    new_str = NULL;
+  
+  return new_str;
+}
+
+int main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.audiofiletest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = my_strdup("$min_audiofile_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_audiofile_version");
+     exit(1);
+   }
+
+   if (($audiofile_major_version > major) ||
+      (($audiofile_major_version == major) && ($audiofile_minor_version > minor)) ||
+      (($audiofile_major_version == major) && ($audiofile_minor_version == minor) && ($audiofile_micro_version >= micro)))
+    {
+      return 0;
+    }
+  else
+    {
+      printf("\n*** 'audiofile-config --version' returned %d.%d.%d, but the minimum version\n", $audiofile_major_version, $audiofile_minor_version, $audiofile_micro_version);
+      printf("*** of the Audio File Library required is %d.%d.%d. If audiofile-config is correct, then it is\n", major, minor, micro);
+      printf("*** best to upgrade to the required version.\n");
+      printf("*** If audiofile-config was wrong, set the environment variable AUDIOFILE_CONFIG\n");
+      printf("*** to point to the correct copy of audiofile-config, and remove the file\n");
+      printf("*** config.cache before re-running configure\n");
+      return 1;
+    }
+}
+
+],, no_audiofile=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+       AC_LANG_RESTORE
+     fi
+  fi
+  if test "x$no_audiofile" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$AUDIOFILE_CONFIG" = "no" ; then
+       cat <<END
+*** The audiofile-config script installed by the Audio File Library could
+*** not be found.  If the Audio File Library was installed in PREFIX, make
+*** sure PREFIX/bin is in your path, or set the AUDIOFILE_CONFIG
+*** environment variable to the full path to audiofile-config.
+END
+     else
+       if test -f conf.audiofiletest ; then
+        :
+       else
+          echo "*** Could not run Audio File Library test program; checking why..."
+          AC_LANG_SAVE
+          AC_LANG_C
+          CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
+          LIBS="$LIBS $AUDIOFILE_LIBS"
+          AC_TRY_LINK([
+#include <stdio.h>
+#include <audiofile.h>
+],      [ return 0; ],
+        [ cat <<END
+*** The test program compiled, but did not run.  This usually means that
+*** the run-time linker is not finding Audio File Library or finding the
+*** wrong version of Audio File Library.
+***
+*** If it is not finding Audio File Library, you'll need to set your
+*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
+*** to the installed location.  Also, make sure you have run ldconfig if
+*** that is required on your system.
+***
+*** If you have an old version installed, it is best to remove it, although
+*** you may also be able to get things to work by modifying
+*** LD_LIBRARY_PATH.
+END
+        ],
+        [ echo "*** The test program failed to compile or link. See the file config.log"
+          echo "*** for the exact error that occured. This usually means the Audio File"
+          echo "*** Library was incorrectly installed or that you have moved the Audio"
+          echo "*** File Library since it was installed. In the latter case, you may want"
+          echo "*** to edit the audiofile-config script: $AUDIOFILE_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+          AC_LANG_RESTORE
+       fi
+     fi
+     AUDIOFILE_CFLAGS=""
+     AUDIOFILE_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(AUDIOFILE_CFLAGS)
+  AC_SUBST(AUDIOFILE_LIBS)
+  rm -f conf.audiofiletest
+])
+
diff --git a/compile b/compile
new file mode 100755
index 000000000..9bb997a6a
--- /dev/null
+++ b/compile
@@ -0,0 +1,99 @@
+#! /bin/sh
+
+# Wrapper for compilers which do not understand `-c -o'.
+
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Usage:
+# compile PROGRAM [ARGS]...
+# `-o FOO.o' is removed from the args passed to the actual compile.
+
+prog=$1
+shift
+
+ofile=
+cfile=
+args=
+while test $# -gt 0; do
+   case "$1" in
+    -o)
+       # configure might choose to run compile as `compile cc -o foo foo.c'.
+       # So we do something ugly here.
+       ofile=$2
+       shift
+       case "$ofile" in
+	*.o | *.obj)
+	   ;;
+	*)
+	   args="$args -o $ofile"
+	   ofile=
+	   ;;
+       esac
+       ;;
+    *.c)
+       cfile=$1
+       args="$args $1"
+       ;;
+    *)
+       args="$args $1"
+       ;;
+   esac
+   shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+   # If no `-o' option was seen then we might have been invoked from a
+   # pattern rule where we don't need one.  That is ok -- this is a
+   # normal compilation that the losing compiler can handle.  If no
+   # `.c' file was seen then we are probably linking.  That is also
+   # ok.
+   exec "$prog" $args
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
+while true; do
+   if mkdir $lockdir > /dev/null 2>&1; then
+      break
+   fi
+   sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir $lockdir; exit 1" 1 2 15
+
+# Run the compile.
+"$prog" $args
+status=$?
+
+if test -f "$cofile"; then
+   mv "$cofile" "$ofile"
+fi
+
+rmdir $lockdir
+exit $status
diff --git a/config.guess b/config.guess
index 0e30d56e9..11271623b 100755
--- a/config.guess
+++ b/config.guess
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-07-02'
+timestamp='2003-10-07'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -734,7 +734,7 @@ EOF
 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
     *:UNICOS/mp:*:*)
-	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' 
+	echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
@@ -751,7 +751,7 @@ EOF
     *:BSD/OS:*:*)
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit 0 ;;
-    *:FreeBSD:*:*|*:GNU/FreeBSD:*:*)
+    *:FreeBSD:*:*)
 	# Determine whether the default compiler uses glibc.
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
@@ -763,7 +763,7 @@ EOF
 	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
-	# GNU/FreeBSD systems have a "k" prefix to indicate we are using
+	# GNU/KFreeBSD systems have a "k" prefix to indicate we are using
 	# FreeBSD's kernel, but not the complete OS.
 	case ${LIBC} in gnu) kernel_only='k' ;; esac
 	echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
@@ -799,8 +799,13 @@ EOF
 	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit 0 ;;
     *:GNU:*:*)
+	# the GNU system
 	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
 	exit 0 ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit 0 ;;
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit 0 ;;
@@ -948,6 +953,9 @@ EOF
 	LIBC=gnuaout
 	#endif
 	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
 	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
@@ -1049,7 +1057,7 @@ EOF
 	exit 0 ;;
     M68*:*:R3V[567]*:*)
 	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -1164,7 +1172,7 @@ EOF
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit 0 ;;
-    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+    NSR-[DGKLNPTVWY]:NONSTOP_KERNEL:*:*)
 	echo nsr-tandem-nsk${UNAME_RELEASE}
 	exit 0 ;;
     *:NonStop-UX:*:*)
diff --git a/config.sub b/config.sub
index 6eea72728..79657cd18 100755
--- a/config.sub
+++ b/config.sub
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
-timestamp='2003-07-17'
+timestamp='2003-10-07'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -118,7 +118,7 @@ esac
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+  nto-qnx* | linux-gnu* | linux-dietlibc | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -248,6 +248,7 @@ case $basic_machine in
 	| mipsisa32 | mipsisa32el \
 	| mipsisa32r2 | mipsisa32r2el \
 	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
 	| mipsisa64sb1 | mipsisa64sb1el \
 	| mipsisa64sr71k | mipsisa64sr71kel \
 	| mipstx39 | mipstx39el \
@@ -320,6 +321,7 @@ case $basic_machine in
 	| mipsisa32-* | mipsisa32el-* \
 	| mipsisa32r2-* | mipsisa32r2el-* \
 	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
 	| mipsisa64sb1-* | mipsisa64sb1el-* \
 	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
 	| mipstx39-* | mipstx39el-* \
@@ -1129,7 +1131,7 @@ case $os in
 	      | -aos* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \
 	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
@@ -1165,6 +1167,9 @@ case $os in
 	-mac*)
 		os=`echo $os | sed -e 's|mac|macos|'`
 		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
 	-linux*)
 		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
diff --git a/configure b/configure
index 8570d9673..3b7dd0a9b 100755
--- a/configure
+++ b/configure
@@ -464,7 +464,7 @@ ac_includes_default="\
 
 ac_subdirs_all="$ac_subdirs_all src/libid3tag"
 ac_subdirs_all="$ac_subdirs_all src/libmad"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL CCAS CCASFLAGS MAD_SUBDIR MAD_LIB ID3_SUBDIR ID3_LIB MPD_LIBS MPD_CFLAGS AO_CFLAGS AO_LIBS subdirs OGG_CFLAGS OGG_LIBS VORBIS_CFLAGS VORBIS_LIBS VORBISFILE_LIBS VORBISENC_LIBS LIBFLAC_CFLAGS LIBFLAC_LIBS LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR RANLIB ac_ct_RANLIB CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL CCAS CCASFLAGS MAD_SUBDIR MAD_LIB ID3_SUBDIR ID3_LIB MPD_LIBS MPD_CFLAGS AO_CFLAGS AO_LIBS subdirs OGG_CFLAGS OGG_LIBS VORBIS_CFLAGS VORBIS_LIBS VORBISFILE_LIBS VORBISENC_LIBS LIBFLAC_CFLAGS LIBFLAC_LIBS AUDIOFILE_CONFIG AUDIOFILE_CFLAGS AUDIOFILE_LIBS LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1033,9 +1033,11 @@ Optional Features:
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
+  --disable-iconv     disable iconv support
   --disable-ogg     disable ogg support
   --disable-flac    disable flac support
   --disable-mp3     disable mp3 support
+  --disable-audiofile disable audiofile support
   --enable-mpd-mad     use mpd libmad
   --disable-id3     disable id3 support
   --enable-mpd-id3tag    use mpd libid3tag
@@ -1043,6 +1045,7 @@ Optional Features:
   --disable-oggtest       Do not try to compile and run a test Ogg program
   --disable-vorbistest       Do not try to compile and run a test Vorbis program
   --disable-libFLACtest       Do not try to compile and run a test libFLAC program
+  --disable-audiofiletest       Do not try to compile and run a test Audio File Library program
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -1070,6 +1073,8 @@ Optional Packages:
   --with-libFLAC=PFX   Prefix where libFLAC is installed (optional)
   --with-libFLAC-libraries=DIR   Directory where libFLAC library is installed (optional)
   --with-libFLAC-includes=DIR   Directory where libFLAC header files are installed (optional)
+  --with-audiofile-prefix=PFX   Prefix where Audio File Library is installed (optional)
+  --with-audiofile-exec-prefix=PFX Exec prefix where Audio File Library is installed (optional)
 
 Some influential environment variables:
   CC          C compiler command
@@ -1745,7 +1750,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=mpd
- VERSION=0.9.2
+ VERSION=0.9.3
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3585,7 +3590,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 3588 "configure"' > conftest.$ac_ext
+  echo '#line 3593 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -5048,7 +5053,7 @@ fi
 
 
 # Provide some information about the compiler.
-echo "$as_me:5051:" \
+echo "$as_me:5056:" \
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -6060,11 +6065,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6063: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6068: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6067: \$? = $ac_status" >&5
+   echo "$as_me:6072: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -6293,11 +6298,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6296: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6301: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:6300: \$? = $ac_status" >&5
+   echo "$as_me:6305: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -6360,11 +6365,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:6363: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:6368: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:6367: \$? = $ac_status" >&5
+   echo "$as_me:6372: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8420,7 +8425,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 8423 "configure"
+#line 8428 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -8518,7 +8523,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 8521 "configure"
+#line 8526 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10677,11 +10682,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10680: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10685: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:10684: \$? = $ac_status" >&5
+   echo "$as_me:10689: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -10744,11 +10749,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10747: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10752: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:10751: \$? = $ac_status" >&5
+   echo "$as_me:10756: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -12001,7 +12006,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12004 "configure"
+#line 12009 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12099,7 +12104,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12102 "configure"
+#line 12107 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12926,11 +12931,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12929: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12934: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12933: \$? = $ac_status" >&5
+   echo "$as_me:12938: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -12993,11 +12998,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12996: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:13001: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:13000: \$? = $ac_status" >&5
+   echo "$as_me:13005: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -14987,11 +14992,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14990: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14995: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14994: \$? = $ac_status" >&5
+   echo "$as_me:14999: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -15220,11 +15225,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15223: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15228: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:15227: \$? = $ac_status" >&5
+   echo "$as_me:15232: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings
@@ -15287,11 +15292,11 @@ else
    -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15290: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15295: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15294: \$? = $ac_status" >&5
+   echo "$as_me:15299: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -17347,7 +17352,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 17350 "configure"
+#line 17355 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17445,7 +17450,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 17448 "configure"
+#line 17453 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18473,6 +18478,13 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 MPD_CFLAGS="-Wall"
 MPD_LIBS=""
 
+# Check whether --enable-ogg or --disable-ogg was given.
+if test "${enable_ogg+set}" = set; then
+  enableval="$enable_ogg"
+
+else
+  enable_iconv=yes
+fi;
 # Check whether --enable-ogg or --disable-ogg was given.
 if test "${enable_ogg+set}" = set; then
   enableval="$enable_ogg"
@@ -18494,6 +18506,13 @@ if test "${enable_mp3+set}" = set; then
 else
   enable_mp3=yes
 fi;
+# Check whether --enable-audiofile or --disable-audiofile was given.
+if test "${enable_audiofile+set}" = set; then
+  enableval="$enable_audiofile"
+
+else
+  enable_audiofile=yes
+fi;
 # Check whether --enable-mpd_mad or --disable-mpd_mad was given.
 if test "${enable_mpd_mad+set}" = set; then
   enableval="$enable_mpd_mad"
@@ -18679,6 +18698,143 @@ if test $ac_cv_lib_nsl_gethostbyname = yes; then
 fi
 
 
+if test x$enable_iconv = xyes; then
+	if test "${ac_cv_header_iconv_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for iconv.h" >&5
+echo $ECHO_N "checking for iconv.h... $ECHO_C" >&6
+if test "${ac_cv_header_iconv_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5
+echo "${ECHO_T}$ac_cv_header_iconv_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking iconv.h usability" >&5
+echo $ECHO_N "checking iconv.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <iconv.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking iconv.h presence" >&5
+echo $ECHO_N "checking iconv.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <iconv.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: iconv.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: iconv.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iconv.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: iconv.h: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: iconv.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: iconv.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iconv.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: iconv.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: iconv.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: iconv.h: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf@gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for iconv.h" >&5
+echo $ECHO_N "checking for iconv.h... $ECHO_C" >&6
+if test "${ac_cv_header_iconv_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_iconv_h=$ac_header_preproc
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5
+echo "${ECHO_T}$ac_cv_header_iconv_h" >&6
+
+fi
+if test $ac_cv_header_iconv_h = yes; then
+  MPD_CFLAGS="$MPD_CFLAGS -DHAVE_ICONV"
+fi
+
+
+fi
+
 echo "$as_me:$LINENO: checking for ipv6" >&5
 echo $ECHO_N "checking for ipv6... $ECHO_C" >&6
 cat >conftest.$ac_ext <<_ACEOF
@@ -20176,6 +20332,318 @@ if test x$enable_flac = xyes; then
 	MPD_CFLAGS="$MPD_CFLAGS -DHAVE_FLAC"
 fi
 
+if test x$enable_audiofile = xyes; then
+
+# Check whether --with-audiofile-prefix or --without-audiofile-prefix was given.
+if test "${with_audiofile_prefix+set}" = set; then
+  withval="$with_audiofile_prefix"
+  audiofile_prefix="$withval"
+else
+  audiofile_prefix=""
+fi;
+
+# Check whether --with-audiofile-exec-prefix or --without-audiofile-exec-prefix was given.
+if test "${with_audiofile_exec_prefix+set}" = set; then
+  withval="$with_audiofile_exec_prefix"
+  audiofile_exec_prefix="$withval"
+else
+  audiofile_exec_prefix=""
+fi;
+# Check whether --enable-audiofiletest or --disable-audiofiletest was given.
+if test "${enable_audiofiletest+set}" = set; then
+  enableval="$enable_audiofiletest"
+
+else
+  enable_audiofiletest=yes
+fi;
+
+  if test x$audiofile_exec_prefix != x ; then
+     audiofile_args="$audiofile_args --exec-prefix=$audiofile_exec_prefix"
+     if test x${AUDIOFILE_CONFIG+set} != xset ; then
+        AUDIOFILE_CONFIG=$audiofile_exec_prefix/bin/audiofile-config
+     fi
+  fi
+  if test x$audiofile_prefix != x ; then
+     audiofile_args="$audiofile_args --prefix=$audiofile_prefix"
+     if test x${AUDIOFILE_CONFIG+set} != xset ; then
+        AUDIOFILE_CONFIG=$audiofile_prefix/bin/audiofile-config
+     fi
+  fi
+
+  # Extract the first word of "audiofile-config", so it can be a program name with args.
+set dummy audiofile-config; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_AUDIOFILE_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $AUDIOFILE_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_AUDIOFILE_CONFIG="$AUDIOFILE_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_AUDIOFILE_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_AUDIOFILE_CONFIG" && ac_cv_path_AUDIOFILE_CONFIG="no"
+  ;;
+esac
+fi
+AUDIOFILE_CONFIG=$ac_cv_path_AUDIOFILE_CONFIG
+
+if test -n "$AUDIOFILE_CONFIG"; then
+  echo "$as_me:$LINENO: result: $AUDIOFILE_CONFIG" >&5
+echo "${ECHO_T}$AUDIOFILE_CONFIG" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  min_audiofile_version=0.1.7
+  echo "$as_me:$LINENO: checking for Audio File Library - version >= $min_audiofile_version" >&5
+echo $ECHO_N "checking for Audio File Library - version >= $min_audiofile_version... $ECHO_C" >&6
+  no_audiofile=""
+  if test "$AUDIOFILE_CONFIG" = "no" ; then
+    no_audiofile=yes
+  else
+    AUDIOFILE_LIBS=`$AUDIOFILE_CONFIG $audiofileconf_args --libs`
+    AUDIOFILE_CFLAGS=`$AUDIOFILE_CONFIG $audiofileconf_args --cflags`
+    audiofile_major_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
+    audiofile_minor_version=`$AUDIOFILE_CONFIG $audiofile_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
+    audiofile_micro_version=`$AUDIOFILE_CONFIG $audiofile_config_args --version | \
+           sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
+    if test "x$enable_audiofiletest" = "xyes" ; then
+
+
+      ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
+      LIBS="$LIBS $AUDIOFILE_LIBS"
+      rm -f conf.audiofiletest
+      if test "$cross_compiling" = yes; then
+  echo $ac_n "cross compiling; assumed OK... $ac_c"
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <audiofile.h>
+
+char*
+my_strdup (char *str)
+{
+  char *new_str;
+
+  if (str)
+    {
+      new_str = malloc ((strlen (str) + 1) * sizeof(char));
+      strcpy (new_str, str);
+    }
+  else
+    new_str = NULL;
+
+  return new_str;
+}
+
+int main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.audiofiletest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = my_strdup("$min_audiofile_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_audiofile_version");
+     exit(1);
+   }
+
+   if (($audiofile_major_version > major) ||
+      (($audiofile_major_version == major) && ($audiofile_minor_version > minor)) ||
+      (($audiofile_major_version == major) && ($audiofile_minor_version == minor) && ($audiofile_micro_version >= micro)))
+    {
+      return 0;
+    }
+  else
+    {
+      printf("\n*** 'audiofile-config --version' returned %d.%d.%d, but the minimum version\n", $audiofile_major_version, $audiofile_minor_version, $audiofile_micro_version);
+      printf("*** of the Audio File Library required is %d.%d.%d. If audiofile-config is correct, then it is\n", major, minor, micro);
+      printf("*** best to upgrade to the required version.\n");
+      printf("*** If audiofile-config was wrong, set the environment variable AUDIOFILE_CONFIG\n");
+      printf("*** to point to the correct copy of audiofile-config, and remove the file\n");
+      printf("*** config.cache before re-running configure\n");
+      return 1;
+    }
+}
+
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+no_audiofile=yes
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+       ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     fi
+  fi
+  if test "x$no_audiofile" = x ; then
+     echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+     MPD_LIBS="$MPD_LIBS -laudiofile" MPD_CFLAGS="$MPD_CFLAGS -DHAVE_AUDIOFILE"
+  else
+     echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+     if test "$AUDIOFILE_CONFIG" = "no" ; then
+       cat <<END
+*** The audiofile-config script installed by the Audio File Library could
+*** not be found.  If the Audio File Library was installed in PREFIX, make
+*** sure PREFIX/bin is in your path, or set the AUDIOFILE_CONFIG
+*** environment variable to the full path to audiofile-config.
+END
+     else
+       if test -f conf.audiofiletest ; then
+        :
+       else
+          echo "*** Could not run Audio File Library test program; checking why..."
+
+
+          ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+          CFLAGS="$CFLAGS $AUDIOFILE_CFLAGS"
+          LIBS="$LIBS $AUDIOFILE_LIBS"
+          cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+#include <stdio.h>
+#include <audiofile.h>
+
+int
+main ()
+{
+ return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+   cat <<END
+*** The test program compiled, but did not run.  This usually means that
+*** the run-time linker is not finding Audio File Library or finding the
+*** wrong version of Audio File Library.
+***
+*** If it is not finding Audio File Library, you'll need to set your
+*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
+*** to the installed location.  Also, make sure you have run ldconfig if
+*** that is required on your system.
+***
+*** If you have an old version installed, it is best to remove it, although
+*** you may also be able to get things to work by modifying
+*** LD_LIBRARY_PATH.
+END
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ echo "*** The test program failed to compile or link. See the file config.log"
+          echo "*** for the exact error that occured. This usually means the Audio File"
+          echo "*** Library was incorrectly installed or that you have moved the Audio"
+          echo "*** File Library since it was installed. In the latter case, you may want"
+          echo "*** to edit the audiofile-config script: $AUDIOFILE_CONFIG"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+          ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+       fi
+     fi
+     AUDIOFILE_CFLAGS=""
+     AUDIOFILE_LIBS=""
+     enable_audiofile=no;{ echo "$as_me:$LINENO: WARNING: You need audiofile  -- disabling audiofile support" >&5
+echo "$as_me: WARNING: You need audiofile  -- disabling audiofile support" >&2;}
+  fi
+
+
+  rm -f conf.audiofiletest
+
+fi
+
                                         ac_config_files="$ac_config_files debian/Makefile doc/Makefile src/Makefile Makefile"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -20908,6 +21376,9 @@ s,@VORBISFILE_LIBS@,$VORBISFILE_LIBS,;t t
 s,@VORBISENC_LIBS@,$VORBISENC_LIBS,;t t
 s,@LIBFLAC_CFLAGS@,$LIBFLAC_CFLAGS,;t t
 s,@LIBFLAC_LIBS@,$LIBFLAC_LIBS,;t t
+s,@AUDIOFILE_CONFIG@,$AUDIOFILE_CONFIG,;t t
+s,@AUDIOFILE_CFLAGS@,$AUDIOFILE_CFLAGS,;t t
+s,@AUDIOFILE_LIBS@,$AUDIOFILE_LIBS,;t t
 s,@LIBOBJS@,$LIBOBJS,;t t
 s,@LTLIBOBJS@,$LTLIBOBJS,;t t
 CEOF
diff --git a/configure.in b/configure.in
index ed4d6e41b..253cd355a 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 AC_INIT(src/main.c)
-AM_INIT_AUTOMAKE(mpd, 0.9.2)
+AM_INIT_AUTOMAKE(mpd, 0.9.3)
 
 AC_PROG_CC
 AC_PROG_INSTALL
@@ -19,9 +19,11 @@ AC_SUBST(MPD_CFLAGS)
 MPD_CFLAGS="-Wall"
 MPD_LIBS=""
 
+AC_ARG_ENABLE(ogg,[  --disable-iconv     disable iconv support],,enable_iconv=yes)
 AC_ARG_ENABLE(ogg,[  --disable-ogg     disable ogg support],,enable_ogg=yes)
 AC_ARG_ENABLE(flac,[  --disable-flac    disable flac support],,enable_flac=yes)
 AC_ARG_ENABLE(mp3,[  --disable-mp3     disable mp3 support],,enable_mp3=yes)
+AC_ARG_ENABLE(audiofile,[  --disable-audiofile disable audiofile support],,enable_audiofile=yes)
 AC_ARG_ENABLE(mpd_mad,[  --enable-mpd-mad     use mpd libmad],use_mpd_mad=yes,)
 AC_ARG_ENABLE(id3,[  --disable-id3     disable id3 support],,enable_id3=yes)
 AC_ARG_ENABLE(mpd_id3tag,[  --enable-mpd-id3tag    use mpd libid3tag],use_mpd_id3tag=yes,)
@@ -37,6 +39,10 @@ AC_ARG_WITH(mad-includes,[  --with-mad-includes=DIR   Directory where mad header
 AC_CHECK_LIB(socket,socket,MPD_LIBS="$MPD_LIBS -lsocket",)
 AC_CHECK_LIB(nsl,gethostbyname,MPD_LIBS="$MPD_LIBS -lnsl",)
 
+if test x$enable_iconv = xyes; then
+	AC_CHECK_HEADER(iconv.h,MPD_CFLAGS="$MPD_CFLAGS -DHAVE_ICONV",)
+fi
+
 AC_MSG_CHECKING(for ipv6)
 AC_EGREP_CPP([AP_maGiC_VALUE],
 [
@@ -242,4 +248,9 @@ if test x$enable_flac = xyes; then
 	MPD_CFLAGS="$MPD_CFLAGS -DHAVE_FLAC"
 fi
 
+if test x$enable_audiofile = xyes; then
+	AM_PATH_AUDIOFILE(0.1.7, MPD_LIBS="$MPD_LIBS -laudiofile" MPD_CFLAGS="$MPD_CFLAGS -DHAVE_AUDIOFILE",
+		[enable_audiofile=no;AC_MSG_WARN(You need audiofile  -- disabling audiofile support)])
+fi
+
 AC_OUTPUT(debian/Makefile doc/Makefile src/Makefile Makefile )
diff --git a/debian/Makefile.am b/debian/Makefile.am
index 64d682118..0b7e04025 100644
--- a/debian/Makefile.am
+++ b/debian/Makefile.am
@@ -1 +1,2 @@
-EXTRA_DIST = changelog compat control copyright dirs docs rules
+EXTRA_DIST = changelog compat control copyright dirs docs rules config \
+		init postinst postrm prerm templates conffiles
diff --git a/debian/Makefile.in b/debian/Makefile.in
index 82d66abed..503dcb8ec 100644
--- a/debian/Makefile.in
+++ b/debian/Makefile.in
@@ -70,6 +70,9 @@ AO_CFLAGS = @AO_CFLAGS@
 AO_LIBS = @AO_LIBS@
 AR = @AR@
 AS = @AS@
+AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@
+AUDIOFILE_CONFIG = @AUDIOFILE_CONFIG@
+AUDIOFILE_LIBS = @AUDIOFILE_LIBS@
 AWK = @AWK@
 CC = @CC@
 CCAS = @CCAS@
@@ -109,7 +112,9 @@ VORBIS_LIBS = @VORBIS_LIBS@
 am__include = @am__include@
 am__quote = @am__quote@
 install_sh = @install_sh@
-EXTRA_DIST = changelog compat control copyright dirs docs rules
+EXTRA_DIST = changelog compat control copyright dirs docs rules config \
+		init postinst postrm prerm templates conffiles
+
 subdir = debian
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
 CONFIG_CLEAN_FILES =
diff --git a/debian/changelog b/debian/changelog
index 824688371..601bb8baa 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,18 @@
+mpd (0.9.3-1) unstable; urgency=low
+
+  * Update to 0.9.3
+  * Switch to cdbs
+  * Use debconf for configure music_directory, playlist_directory, port
+  * Add /etc/mpd.conf and /etc/mpd/conf
+  * Add initd script
+
+ -- Warren Dukes (aka shank) <shank@mercury.chem.pitt.edu>  Tue, 31 Oct 2003 18:16:00 -0400
+
 mpd (0.9.2-1) unstable; urgency=low
 
   * Update to 0.9.2
 
- -- Warren Dukes <shank@mercury.chem.pitt.edu>  Tue, 06 Oct 2003 22:04:00 -0400
+ -- Warren Dukes (aka shank) <shank@mercury.chem.pitt.edu>  Tue, 06 Oct 2003 22:04:00 -0400
 
 mpd (0.9.1-1) unstable; urgency=low
 
diff --git a/debian/conffiles b/debian/conffiles
new file mode 100644
index 000000000..2e1fb117e
--- /dev/null
+++ b/debian/conffiles
@@ -0,0 +1 @@
+/etc/mpd/conf
diff --git a/debian/config b/debian/config
new file mode 100644
index 000000000..eeebc2d6b
--- /dev/null
+++ b/debian/config
@@ -0,0 +1,20 @@
+#!/bin/sh -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+# Do you like debian?
+db_input medium mpd/systemwide || true
+db_go
+db_get mpd/systemwide || true
+
+if [ "$RET" = "true" ] ; then
+	db_input medium mpd/music_directory || true
+	db_go
+
+	db_input medium mpd/playlist_directory || true
+	db_go
+
+	db_input low mpd/port || true
+	db_go
+fi
diff --git a/debian/control b/debian/control
index 9ebeae93c..1dee91c1c 100644
--- a/debian/control
+++ b/debian/control
@@ -1,13 +1,13 @@
 Source: mpd
 Section: sound
 Priority: optional
-Maintainer: Warren Dukes <shank@mercury.chem.pitt.edu>
-Build-Depends: debhelper (>> 4.0.0), libao-dev (>=0.8.3-1), libogg-dev, libvorbis-dev, libflac-dev (>=1.1.0-4), libmad0-dev, libid3tag0-dev
+Maintainer: Warren Dukes (aka shank) <shank@mercury.chem.pitt.edu>
+Build-Depends: debhelper (>> 4.0.0), libao-dev (>=0.8.3-1), libogg-dev, libvorbis-dev, libflac-dev (>=1.1.0-4), libmad0-dev, libid3tag0-dev, debconf, cdbs, libaudiofile-dev
 Standards-Version: 3.5.8
 
 Package: mpd
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Music Player Daemon (MPD)
  MPD is a server that allows remote access for playing 
  music (MP3, Ogg Vorbis, and Flac) and managing playlists. The design focus is 
diff --git a/debian/init b/debian/init
new file mode 100644
index 000000000..9539f1de9
--- /dev/null
+++ b/debian/init
@@ -0,0 +1,35 @@
+#! /bin/sh
+set -e
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+DAEMON=/usr/bin/mpd
+DBFILE=/var/run/mpd/mpddb
+
+test -x $DAEMON || exit 0
+
+case "$1" in
+  start)
+	if test -f $DBFILE; then
+		echo -n "Starting Music Player Daemon: mpd"
+		start-stop-daemon --start --quiet --exec $DAEMON 
+		echo "."
+	else
+		echo "MPD db not found, run: $DAEMON --create-db."
+	fi
+  ;;
+  stop)
+	echo -n "Stopping Music Player Daemon: mpd"
+	start-stop-daemon --stop --quiet --exec $DAEMON || echo -n " ... mpd not running"
+	echo "."
+  ;;
+  restart|force-reload)
+	$0 stop
+	$0 start
+  ;;
+  *)
+	echo "Usage: /etc/init.d/mpd {start|stop|restart|force-reload}"
+	exit 1
+  ;;
+esac
+
+exit 0
diff --git a/debian/postinst b/debian/postinst
new file mode 100644
index 000000000..ace16df24
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,45 @@
+#!/bin/sh -e
+
+# Source debconf library.
+. /usr/share/debconf/confmodule
+
+db_get mpd/systemwide || true
+
+if [ "$RET"  = "true" ] ; then
+	echo "# BEGIN - GENERTATED BY DEBCONF" > /etc/mpd.conf
+	db_get mpd/music_directory || true
+	echo "music_directory \"$RET\"" >> /etc/mpd.conf
+
+	db_get mpd/playlist_directory || true
+	echo "playlist_directory \"$RET\"" >> /etc/mpd.conf
+
+	db_get mpd/port || true
+	echo "port \"$RET\"" >> /etc/mpd.conf
+	echo "# END - GENERTATED BY DEBCONF" >> /etc/mpd.conf
+	echo "" >> /etc/mpd.conf
+
+	echo "# Rest included from /etc/mpd/conf" >> /etc/mpd.conf
+	cat /etc/mpd/conf >> /etc/mpd.conf
+
+	chmod 600 /etc/mpd.conf
+
+	groupadd mpd > /dev/null 2>&1 || true
+	useradd -M -g mpd -G mpd,audio mpd > /dev/null 2>&1  || true
+	mkdir -p /var/log/mpd
+	chown mpd.mpd /var/log/mpd
+	chmod 700 /var/log/mpd
+	mkdir -p /var/lib/mpd
+	chown mpd.mpd /var/lib/mpd
+	chmod 700 /var/lib/mpd
+
+	# Automatically added by dh_installinit
+	if [ -x "/etc/init.d/mpd" ]; then
+		update-rc.d mpd defaults >/dev/null
+		if [ -x /usr/sbin/invoke-rc.d ]; then
+			invoke-rc.d mpd start
+		else
+			/etc/init.d/mpd start
+		fi
+	fi
+	# End automatically added section
+fi
diff --git a/debian/postrm b/debian/postrm
new file mode 100644
index 000000000..5d090f143
--- /dev/null
+++ b/debian/postrm
@@ -0,0 +1,18 @@
+#!/bin/sh -e
+
+rm -r /var/log/mpd > /dev/null 2>&1 || true
+rm -r /var/lib/mpd > /dev/null 2>&1 || true
+
+# Automatically added by dh_installinit
+if [ "$1" = "purge" ] ; then
+	update-rc.d mpd remove defaults >/dev/null
+	rm -rf /var/log/mpd
+	rm -rf /var/lib/mpd
+	rm -f /etc/mpd.conf
+fi
+# Automatically added by dh_installdebconf
+if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
+	. /usr/share/debconf/confmodule
+	db_purge
+fi
+# End automatically added section
diff --git a/debian/prerm b/debian/prerm
new file mode 100644
index 000000000..66c4e6529
--- /dev/null
+++ b/debian/prerm
@@ -0,0 +1,11 @@
+#!/bin/sh -e
+
+# Automatically added by dh_installinit
+if [ -x "/etc/init.d/mpd" ]; then
+	if [ -x /usr/sbin/invoke-rc.d ] ; then
+		invoke-rc.d mpd stop
+	else
+		/etc/init.d/mpd stop
+	fi
+fi
+# End automatically added section
diff --git a/debian/rules b/debian/rules
index 4cc79d70a..c215f6a95 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,106 +1,13 @@
 #!/usr/bin/make -f
-# Sample debian/rules that uses debhelper.
-# GNU copyright 1997 to 1999 by Joey Hess.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-
-
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
-else
-	CFLAGS += -O2
-endif
-ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
-	INSTALL_PROGRAM += -s
-endif
-
-config.status: configure
-	dh_testdir
-	# Add here commands to configure the package.
-	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
-
-
-build: build-stamp
-
-build-stamp:  config.status
-	dh_testdir
-
-	# Add here commands to compile the package.
-	$(MAKE)
-	#/usr/bin/docbook-to-man debian/mpd.sgml > mpd.1
-
-	touch build-stamp
-
-clean:
-	dh_testdir
-	dh_testroot
-	rm -f build-stamp 
-
-	# Add here commands to clean up after the build process.
-	-$(MAKE) distclean
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
-	cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
-	cp -f /usr/share/misc/config.guess config.guess
-endif
-
-
-	dh_clean
-
-install: build
-	dh_testdir
-	dh_testroot
-	dh_clean -k
-	dh_installdirs
-
-	# Add here commands to install the package into debian/mpd.
-	$(MAKE) install DESTDIR=$(CURDIR)/debian/mpd
-
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-	dh_testdir
-	dh_testroot
-	dh_installchangelogs ChangeLog
-	dh_installdocs
-	dh_installexamples doc/mpdconf.example
-#	dh_install
-#	dh_installmenu
-#	dh_installdebconf	
-#	dh_installlogrotate
-#	dh_installemacsen
-#	dh_installpam
-#	dh_installmime
-#	dh_installinit
-#	dh_installcron
-#	dh_installinfo
-	dh_installman
-#	dh_link
-	dh_strip
-	dh_compress
-	dh_fixperms
-#	dh_perl
-#	dh_python
-#	dh_makeshlibs
-	dh_installdeb
-	dh_shlibdeps
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install 
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+
+binary-post-install/mpd::
+	mkdir -p debian/mpd/usr/share/doc/mpd/examples
+	cp doc/mpdconf.example debian/mpd/usr/share/doc/mpd/examples
+	mkdir -p debian/mpd/etc/mpd
+	echo "#see manpage for mpd for all config options" > debian/mpd/etc/mpd/conf
+	echo "log_file \"/var/log/mpd/mpd_log\"" >> debian/mpd/etc/mpd/conf
+	echo "error_file \"/var/log/mpd/mpd_errors\"" >> debian/mpd/etc/mpd/conf
+	echo "db_file \"/var/lib/mpd/mpddb\"" >> debian/mpd/etc/mpd/conf
+	echo "user \"mpd\"" >> debian/mpd/etc/mpd/conf
diff --git a/debian/templates b/debian/templates
new file mode 100644
index 000000000..f536b5ea6
--- /dev/null
+++ b/debian/templates
@@ -0,0 +1,25 @@
+Template: mpd/systemwide
+Type: boolean
+Default: false
+Description: Install system mpd service?
+ You can install mpd as a system daemon.  This will create a mpd user and 
+ config file (/etc/mpd.conf).  The mpd service will be 
+ started on boot.
+
+Template: mpd/music_directory
+Type: string
+Default: /usr/share/mpd/music
+Description: Music directory for MPD
+ Which directory do you want MPD to search in for music files?
+
+Template: mpd/playlist_directory
+Type: string
+Default: /usr/share/mpd/playlists
+Description: Music directory for MPD
+ Which directory do you want MPD to search in for music files?
+
+Template: mpd/port
+Type: string
+Default: 2100
+Description: Port MPD listens on
+ Which port number do you want MPD to listen on?
diff --git a/doc/COMMANDS b/doc/COMMANDS
index 86207029a..4bcc9899f 100644
--- a/doc/COMMANDS
+++ b/doc/COMMANDS
@@ -130,6 +130,7 @@ status
 	state: ("play", "stop", or "pause")
 	song: (current song playing/paused, playlist song number)
 	time: <int elapsed>:<time total> (of current playing/paused song)
+	bitrate: <int bitrate> (instantaneous bitrate in kbps)
 	error: if there is an error, returns message here
 
 stop
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 82fd65dbe..8588e918b 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -70,6 +70,9 @@ AO_CFLAGS = @AO_CFLAGS@
 AO_LIBS = @AO_LIBS@
 AR = @AR@
 AS = @AS@
+AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@
+AUDIOFILE_CONFIG = @AUDIOFILE_CONFIG@
+AUDIOFILE_LIBS = @AUDIOFILE_LIBS@
 AWK = @AWK@
 CC = @CC@
 CCAS = @CCAS@
diff --git a/doc/mpd.1 b/doc/mpd.1
index be39f498e..c1bf8972d 100644
--- a/doc/mpd.1
+++ b/doc/mpd.1
@@ -124,7 +124,8 @@ This specifies which address MPD binds to and listens on.  The default is "any",
 which binds to all available addresses.
 .SH EXAMPLES
 .TP
-Below is an example config file.
+Below is an example config file. (Note: '#' at the beginning of a line denotes
+a comment.  The '#' must be the first character/symbol on that line.)
 .br
 
 .br
diff --git a/install-sh b/install-sh
index fca26e562..d4744f0c7 100755
--- a/install-sh
+++ b/install-sh
@@ -127,7 +127,7 @@ then
 	echo "install:	no input file specified"
 	exit 1
 else
-	:
+	true
 fi
 
 if [ x"$dir_arg" != x ]; then
@@ -138,7 +138,7 @@ if [ x"$dir_arg" != x ]; then
 		instcmd=:
 		chmodcmd=""
 	else
-		instcmd=$mkdirprog
+		instcmd=mkdir
 	fi
 else
 
@@ -146,9 +146,9 @@ else
 # might cause directories to be created, which would be especially bad 
 # if $src (and thus $dsttmp) contains '*'.
 
-	if [ -f "$src" ] || [ -d "$src" ]
+	if [ -f $src -o -d $src ]
 	then
-		:
+		true
 	else
 		echo "install:  $src does not exist"
 		exit 1
@@ -159,7 +159,7 @@ else
 		echo "install:	no destination specified"
 		exit 1
 	else
-		:
+		true
 	fi
 
 # If destination is a directory, append the input filename; if your system
@@ -169,7 +169,7 @@ else
 	then
 		dst="$dst"/`basename $src`
 	else
-		:
+		true
 	fi
 fi
 
@@ -181,8 +181,8 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
 
 # Skip lots of stat calls in the usual case.
 if [ ! -d "$dstdir" ]; then
-defaultIFS='
-	'
+defaultIFS=' 	
+'
 IFS="${IFS-${defaultIFS}}"
 
 oIFS="${IFS}"
@@ -201,7 +201,7 @@ while [ $# -ne 0 ] ; do
         then
 		$mkdirprog "${pathcomp}"
 	else
-		:
+		true
 	fi
 
 	pathcomp="${pathcomp}/"
@@ -212,10 +212,10 @@ if [ x"$dir_arg" != x ]
 then
 	$doit $instcmd $dst &&
 
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
 else
 
 # If we're going to rename the final executable, determine the name now.
@@ -234,7 +234,7 @@ else
 	then
 		dstfile=`basename $dst`
 	else
-		:
+		true
 	fi
 
 # Make a temp file name in the proper directory.
@@ -253,10 +253,10 @@ else
 # ignore errors from any of these, just make sure not to ignore
 # errors from the above "$doit $instcmd $src $dsttmp" command.
 
-	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi &&
-	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi &&
-	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi &&
-	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi &&
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
 
 # Now rename the file to the real destination.
 
diff --git a/mkinstalldirs b/mkinstalldirs
index 8ab885ec9..4f58503ea 100755
--- a/mkinstalldirs
+++ b/mkinstalldirs
@@ -4,53 +4,9 @@
 # Created: 1993-05-16
 # Public domain
 
-errstatus=0
-dirmode=""
-
-usage="\
-Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
-
-# process command line arguments
-while test $# -gt 0 ; do
-   case "${1}" in
-     -h | --help | --h* )			# -h for help
-	echo "${usage}" 1>&2; exit 0 ;;
-     -m )					# -m PERM arg
-	shift
-	test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
-	dirmode="${1}"
-	shift ;;
-     -- ) shift; break ;;			# stop option processing
-     -* ) echo "${usage}" 1>&2; exit 1 ;;	# unknown option
-     * )  break ;;				# first non-opt arg
-   esac
-done
-
-for file
-do
-  if test -d "$file"; then
-    shift
-  else
-    break
-  fi
-done
-
-case $# in
-0) exit 0 ;;
-esac
+# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
 
-case $dirmode in
-'')
-  if mkdir -p -- . 2>/dev/null; then
-    echo "mkdir -p -- $*"
-    exec mkdir -p -- "$@"
-  fi ;;
-*)
-  if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
-    echo "mkdir -m $dirmode -p -- $*"
-    exec mkdir -m "$dirmode" -p -- "$@"
-  fi ;;
-esac
+errstatus=0
 
 for file
 do
@@ -66,24 +22,13 @@ do
      esac
 
      if test ! -d "$pathcomp"; then
-	echo "mkdir $pathcomp"
-
-	mkdir "$pathcomp" || lasterr=$?
-
-	if test ! -d "$pathcomp"; then
-	  errstatus=$lasterr
-	else
-	  if test ! -z "$dirmode"; then
-	     echo "chmod $dirmode $pathcomp"
+        echo "mkdir $pathcomp"
 
-	     lasterr=""
-	     chmod "$dirmode" "$pathcomp" || lasterr=$?
+        mkdir "$pathcomp" || lasterr=$?
 
-	     if test ! -z "$lasterr"; then
-	       errstatus=$lasterr
-	     fi
-	  fi
-	fi
+        if test ! -d "$pathcomp"; then
+  	  errstatus=$lasterr
+        fi
      fi
 
      pathcomp="$pathcomp/"
@@ -92,8 +37,4 @@ done
 
 exit $errstatus
 
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 3
-# End:
 # mkinstalldirs ends here
diff --git a/src/Makefile.am b/src/Makefile.am
index 5729e3baa..448d71679 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,12 +3,13 @@ SUBDIRS = $(ID3_SUBDIR) $(MAD_SUBDIR)
 mpd_headers = buffer2array.h interface.h command.h playlist.h ls.h \
 	song.h list.h directory.h tables.h utils.h path.h mp3_decode.h \
 	tag.h player.h listen.h conf.h ogg_decode.h volume.h flac_decode.h \
-	audio.h playerData.h stats.h myfprintf.h sig_handlers.h decode.h log.h
+	audio.h playerData.h stats.h myfprintf.h sig_handlers.h decode.h log.h \
+	char_conv.h audiofile_decode.h
 mpd_SOURCES = main.c buffer2array.c interface.c command.c playlist.c ls.c \
 	song.c list.c directory.c tables.c utils.c path.c mp3_decode.c \
 	tag.c player.c listen.c conf.c ogg_decode.c volume.c flac_decode.c \
 	audio.c playerData.c stats.c myfprintf.c sig_handlers.c decode.c log.c \
-	$(mpd_headers)
+	char_conv.c audiofile_decode.c $(mpd_headers)
 
-CFLAGS = @CFLAGS@ $(MPD_CFLAGS)
+mpd_CFLAGS = $(MPD_CFLAGS)
 mpd_LDADD = $(MPD_LIBS) $(ID3_LIB) $(MAD_LIB)
diff --git a/src/Makefile.in b/src/Makefile.in
index 42bc1b349..9c24f2a87 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -70,6 +70,9 @@ AO_CFLAGS = @AO_CFLAGS@
 AO_LIBS = @AO_LIBS@
 AR = @AR@
 AS = @AS@
+AUDIOFILE_CFLAGS = @AUDIOFILE_CFLAGS@
+AUDIOFILE_CONFIG = @AUDIOFILE_CONFIG@
+AUDIOFILE_LIBS = @AUDIOFILE_LIBS@
 AWK = @AWK@
 CC = @CC@
 CCAS = @CCAS@
@@ -114,16 +117,17 @@ SUBDIRS = $(ID3_SUBDIR) $(MAD_SUBDIR)
 mpd_headers = buffer2array.h interface.h command.h playlist.h ls.h \
 	song.h list.h directory.h tables.h utils.h path.h mp3_decode.h \
 	tag.h player.h listen.h conf.h ogg_decode.h volume.h flac_decode.h \
-	audio.h playerData.h stats.h myfprintf.h sig_handlers.h decode.h log.h
+	audio.h playerData.h stats.h myfprintf.h sig_handlers.h decode.h log.h \
+	char_conv.h audiofile_decode.h
 
 mpd_SOURCES = main.c buffer2array.c interface.c command.c playlist.c ls.c \
 	song.c list.c directory.c tables.c utils.c path.c mp3_decode.c \
 	tag.c player.c listen.c conf.c ogg_decode.c volume.c flac_decode.c \
 	audio.c playerData.c stats.c myfprintf.c sig_handlers.c decode.c log.c \
-	$(mpd_headers)
+	char_conv.c audiofile_decode.c $(mpd_headers)
 
 
-CFLAGS = @CFLAGS@ $(MPD_CFLAGS)
+mpd_CFLAGS = $(MPD_CFLAGS)
 mpd_LDADD = $(MPD_LIBS) $(ID3_LIB) $(MAD_LIB)
 subdir = src
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -132,16 +136,19 @@ bin_PROGRAMS = mpd$(EXEEXT)
 PROGRAMS = $(bin_PROGRAMS)
 
 am__objects_1 =
-am_mpd_OBJECTS = main.$(OBJEXT) buffer2array.$(OBJEXT) \
-	interface.$(OBJEXT) command.$(OBJEXT) playlist.$(OBJEXT) \
-	ls.$(OBJEXT) song.$(OBJEXT) list.$(OBJEXT) directory.$(OBJEXT) \
-	tables.$(OBJEXT) utils.$(OBJEXT) path.$(OBJEXT) \
-	mp3_decode.$(OBJEXT) tag.$(OBJEXT) player.$(OBJEXT) \
-	listen.$(OBJEXT) conf.$(OBJEXT) ogg_decode.$(OBJEXT) \
-	volume.$(OBJEXT) flac_decode.$(OBJEXT) audio.$(OBJEXT) \
-	playerData.$(OBJEXT) stats.$(OBJEXT) myfprintf.$(OBJEXT) \
-	sig_handlers.$(OBJEXT) decode.$(OBJEXT) log.$(OBJEXT) \
-	$(am__objects_1)
+am_mpd_OBJECTS = mpd-main.$(OBJEXT) mpd-buffer2array.$(OBJEXT) \
+	mpd-interface.$(OBJEXT) mpd-command.$(OBJEXT) \
+	mpd-playlist.$(OBJEXT) mpd-ls.$(OBJEXT) mpd-song.$(OBJEXT) \
+	mpd-list.$(OBJEXT) mpd-directory.$(OBJEXT) mpd-tables.$(OBJEXT) \
+	mpd-utils.$(OBJEXT) mpd-path.$(OBJEXT) mpd-mp3_decode.$(OBJEXT) \
+	mpd-tag.$(OBJEXT) mpd-player.$(OBJEXT) mpd-listen.$(OBJEXT) \
+	mpd-conf.$(OBJEXT) mpd-ogg_decode.$(OBJEXT) \
+	mpd-volume.$(OBJEXT) mpd-flac_decode.$(OBJEXT) \
+	mpd-audio.$(OBJEXT) mpd-playerData.$(OBJEXT) \
+	mpd-stats.$(OBJEXT) mpd-myfprintf.$(OBJEXT) \
+	mpd-sig_handlers.$(OBJEXT) mpd-decode.$(OBJEXT) \
+	mpd-log.$(OBJEXT) mpd-char_conv.$(OBJEXT) \
+	mpd-audiofile_decode.$(OBJEXT) $(am__objects_1)
 mpd_OBJECTS = $(am_mpd_OBJECTS)
 mpd_DEPENDENCIES =
 mpd_LDFLAGS =
@@ -153,20 +160,28 @@ LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
-@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/audio.Po ./$(DEPDIR)/buffer2array.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/command.Po ./$(DEPDIR)/conf.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/decode.Po ./$(DEPDIR)/directory.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/flac_decode.Po ./$(DEPDIR)/interface.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/list.Po ./$(DEPDIR)/listen.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/log.Po ./$(DEPDIR)/ls.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/main.Po ./$(DEPDIR)/mp3_decode.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/myfprintf.Po ./$(DEPDIR)/ogg_decode.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/path.Po ./$(DEPDIR)/player.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/playerData.Po ./$(DEPDIR)/playlist.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/sig_handlers.Po ./$(DEPDIR)/song.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/stats.Po ./$(DEPDIR)/tables.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/tag.Po ./$(DEPDIR)/utils.Po \
-@AMDEP_TRUE@	./$(DEPDIR)/volume.Po
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/mpd-audio.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-audiofile_decode.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-buffer2array.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-char_conv.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-command.Po ./$(DEPDIR)/mpd-conf.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-decode.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-directory.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-flac_decode.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-interface.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-list.Po ./$(DEPDIR)/mpd-listen.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-log.Po ./$(DEPDIR)/mpd-ls.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-main.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-mp3_decode.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-myfprintf.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-ogg_decode.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-path.Po ./$(DEPDIR)/mpd-player.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-playerData.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-playlist.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-sig_handlers.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-song.Po ./$(DEPDIR)/mpd-stats.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-tables.Po ./$(DEPDIR)/mpd-tag.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/mpd-utils.Po ./$(DEPDIR)/mpd-volume.Po
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
@@ -174,6 +189,7 @@ LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
 CCLD = $(CC)
 LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
 DIST_SOURCES = $(mpd_SOURCES)
 
 RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \
@@ -222,6 +238,35 @@ clean-binPROGRAMS:
 	  echo " rm -f $$p $$f"; \
 	  rm -f $$p $$f ; \
 	done
+mpd-main.$(OBJEXT): main.c
+mpd-buffer2array.$(OBJEXT): buffer2array.c
+mpd-interface.$(OBJEXT): interface.c
+mpd-command.$(OBJEXT): command.c
+mpd-playlist.$(OBJEXT): playlist.c
+mpd-ls.$(OBJEXT): ls.c
+mpd-song.$(OBJEXT): song.c
+mpd-list.$(OBJEXT): list.c
+mpd-directory.$(OBJEXT): directory.c
+mpd-tables.$(OBJEXT): tables.c
+mpd-utils.$(OBJEXT): utils.c
+mpd-path.$(OBJEXT): path.c
+mpd-mp3_decode.$(OBJEXT): mp3_decode.c
+mpd-tag.$(OBJEXT): tag.c
+mpd-player.$(OBJEXT): player.c
+mpd-listen.$(OBJEXT): listen.c
+mpd-conf.$(OBJEXT): conf.c
+mpd-ogg_decode.$(OBJEXT): ogg_decode.c
+mpd-volume.$(OBJEXT): volume.c
+mpd-flac_decode.$(OBJEXT): flac_decode.c
+mpd-audio.$(OBJEXT): audio.c
+mpd-playerData.$(OBJEXT): playerData.c
+mpd-stats.$(OBJEXT): stats.c
+mpd-myfprintf.$(OBJEXT): myfprintf.c
+mpd-sig_handlers.$(OBJEXT): sig_handlers.c
+mpd-decode.$(OBJEXT): decode.c
+mpd-log.$(OBJEXT): log.c
+mpd-char_conv.$(OBJEXT): char_conv.c
+mpd-audiofile_decode.$(OBJEXT): audiofile_decode.c
 mpd$(EXEEXT): $(mpd_OBJECTS) $(mpd_DEPENDENCIES) 
 	@rm -f mpd$(EXEEXT)
 	$(LINK) $(mpd_LDFLAGS) $(mpd_OBJECTS) $(mpd_LDADD) $(LIBS)
@@ -232,33 +277,35 @@ mostlyclean-compile:
 distclean-compile:
 	-rm -f *.tab.c
 
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/audio.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer2array.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/command.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/directory.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flac_decode.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interface.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listen.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ls.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp3_decode.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/myfprintf.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_decode.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/playerData.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/playlist.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sig_handlers.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/song.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stats.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tables.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volume.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-audio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-audiofile_decode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-buffer2array.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-char_conv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-command.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-conf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-decode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-directory.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-flac_decode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-interface.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-list.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-listen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-log.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-ls.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-mp3_decode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-myfprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-ogg_decode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-path.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-player.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-playerData.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-playlist.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-sig_handlers.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-song.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-stats.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-tables.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-tag.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-utils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mpd-volume.Po@am__quote@
 
 distclean-depend:
 	-rm -rf ./$(DEPDIR)
@@ -280,6 +327,528 @@ distclean-depend:
 @AMDEP_TRUE@	depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
 @AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 	$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+mpd-main.o: main.c
+@AMDEP_TRUE@	source='main.c' object='mpd-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-main.Po' tmpdepfile='$(DEPDIR)/mpd-main.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c
+
+mpd-main.obj: main.c
+@AMDEP_TRUE@	source='main.c' object='mpd-main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-main.Po' tmpdepfile='$(DEPDIR)/mpd-main.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-main.obj `cygpath -w main.c`
+
+mpd-main.lo: main.c
+@AMDEP_TRUE@	source='main.c' object='mpd-main.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-main.Plo' tmpdepfile='$(DEPDIR)/mpd-main.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-main.lo `test -f 'main.c' || echo '$(srcdir)/'`main.c
+
+mpd-buffer2array.o: buffer2array.c
+@AMDEP_TRUE@	source='buffer2array.c' object='mpd-buffer2array.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-buffer2array.Po' tmpdepfile='$(DEPDIR)/mpd-buffer2array.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-buffer2array.o `test -f 'buffer2array.c' || echo '$(srcdir)/'`buffer2array.c
+
+mpd-buffer2array.obj: buffer2array.c
+@AMDEP_TRUE@	source='buffer2array.c' object='mpd-buffer2array.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-buffer2array.Po' tmpdepfile='$(DEPDIR)/mpd-buffer2array.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-buffer2array.obj `cygpath -w buffer2array.c`
+
+mpd-buffer2array.lo: buffer2array.c
+@AMDEP_TRUE@	source='buffer2array.c' object='mpd-buffer2array.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-buffer2array.Plo' tmpdepfile='$(DEPDIR)/mpd-buffer2array.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-buffer2array.lo `test -f 'buffer2array.c' || echo '$(srcdir)/'`buffer2array.c
+
+mpd-interface.o: interface.c
+@AMDEP_TRUE@	source='interface.c' object='mpd-interface.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-interface.Po' tmpdepfile='$(DEPDIR)/mpd-interface.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-interface.o `test -f 'interface.c' || echo '$(srcdir)/'`interface.c
+
+mpd-interface.obj: interface.c
+@AMDEP_TRUE@	source='interface.c' object='mpd-interface.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-interface.Po' tmpdepfile='$(DEPDIR)/mpd-interface.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-interface.obj `cygpath -w interface.c`
+
+mpd-interface.lo: interface.c
+@AMDEP_TRUE@	source='interface.c' object='mpd-interface.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-interface.Plo' tmpdepfile='$(DEPDIR)/mpd-interface.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-interface.lo `test -f 'interface.c' || echo '$(srcdir)/'`interface.c
+
+mpd-command.o: command.c
+@AMDEP_TRUE@	source='command.c' object='mpd-command.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-command.Po' tmpdepfile='$(DEPDIR)/mpd-command.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-command.o `test -f 'command.c' || echo '$(srcdir)/'`command.c
+
+mpd-command.obj: command.c
+@AMDEP_TRUE@	source='command.c' object='mpd-command.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-command.Po' tmpdepfile='$(DEPDIR)/mpd-command.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-command.obj `cygpath -w command.c`
+
+mpd-command.lo: command.c
+@AMDEP_TRUE@	source='command.c' object='mpd-command.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-command.Plo' tmpdepfile='$(DEPDIR)/mpd-command.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-command.lo `test -f 'command.c' || echo '$(srcdir)/'`command.c
+
+mpd-playlist.o: playlist.c
+@AMDEP_TRUE@	source='playlist.c' object='mpd-playlist.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-playlist.Po' tmpdepfile='$(DEPDIR)/mpd-playlist.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-playlist.o `test -f 'playlist.c' || echo '$(srcdir)/'`playlist.c
+
+mpd-playlist.obj: playlist.c
+@AMDEP_TRUE@	source='playlist.c' object='mpd-playlist.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-playlist.Po' tmpdepfile='$(DEPDIR)/mpd-playlist.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-playlist.obj `cygpath -w playlist.c`
+
+mpd-playlist.lo: playlist.c
+@AMDEP_TRUE@	source='playlist.c' object='mpd-playlist.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-playlist.Plo' tmpdepfile='$(DEPDIR)/mpd-playlist.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-playlist.lo `test -f 'playlist.c' || echo '$(srcdir)/'`playlist.c
+
+mpd-ls.o: ls.c
+@AMDEP_TRUE@	source='ls.c' object='mpd-ls.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-ls.Po' tmpdepfile='$(DEPDIR)/mpd-ls.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ls.o `test -f 'ls.c' || echo '$(srcdir)/'`ls.c
+
+mpd-ls.obj: ls.c
+@AMDEP_TRUE@	source='ls.c' object='mpd-ls.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-ls.Po' tmpdepfile='$(DEPDIR)/mpd-ls.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ls.obj `cygpath -w ls.c`
+
+mpd-ls.lo: ls.c
+@AMDEP_TRUE@	source='ls.c' object='mpd-ls.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-ls.Plo' tmpdepfile='$(DEPDIR)/mpd-ls.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ls.lo `test -f 'ls.c' || echo '$(srcdir)/'`ls.c
+
+mpd-song.o: song.c
+@AMDEP_TRUE@	source='song.c' object='mpd-song.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-song.Po' tmpdepfile='$(DEPDIR)/mpd-song.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-song.o `test -f 'song.c' || echo '$(srcdir)/'`song.c
+
+mpd-song.obj: song.c
+@AMDEP_TRUE@	source='song.c' object='mpd-song.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-song.Po' tmpdepfile='$(DEPDIR)/mpd-song.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-song.obj `cygpath -w song.c`
+
+mpd-song.lo: song.c
+@AMDEP_TRUE@	source='song.c' object='mpd-song.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-song.Plo' tmpdepfile='$(DEPDIR)/mpd-song.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-song.lo `test -f 'song.c' || echo '$(srcdir)/'`song.c
+
+mpd-list.o: list.c
+@AMDEP_TRUE@	source='list.c' object='mpd-list.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-list.Po' tmpdepfile='$(DEPDIR)/mpd-list.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-list.o `test -f 'list.c' || echo '$(srcdir)/'`list.c
+
+mpd-list.obj: list.c
+@AMDEP_TRUE@	source='list.c' object='mpd-list.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-list.Po' tmpdepfile='$(DEPDIR)/mpd-list.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-list.obj `cygpath -w list.c`
+
+mpd-list.lo: list.c
+@AMDEP_TRUE@	source='list.c' object='mpd-list.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-list.Plo' tmpdepfile='$(DEPDIR)/mpd-list.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-list.lo `test -f 'list.c' || echo '$(srcdir)/'`list.c
+
+mpd-directory.o: directory.c
+@AMDEP_TRUE@	source='directory.c' object='mpd-directory.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-directory.Po' tmpdepfile='$(DEPDIR)/mpd-directory.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-directory.o `test -f 'directory.c' || echo '$(srcdir)/'`directory.c
+
+mpd-directory.obj: directory.c
+@AMDEP_TRUE@	source='directory.c' object='mpd-directory.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-directory.Po' tmpdepfile='$(DEPDIR)/mpd-directory.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-directory.obj `cygpath -w directory.c`
+
+mpd-directory.lo: directory.c
+@AMDEP_TRUE@	source='directory.c' object='mpd-directory.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-directory.Plo' tmpdepfile='$(DEPDIR)/mpd-directory.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-directory.lo `test -f 'directory.c' || echo '$(srcdir)/'`directory.c
+
+mpd-tables.o: tables.c
+@AMDEP_TRUE@	source='tables.c' object='mpd-tables.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-tables.Po' tmpdepfile='$(DEPDIR)/mpd-tables.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-tables.o `test -f 'tables.c' || echo '$(srcdir)/'`tables.c
+
+mpd-tables.obj: tables.c
+@AMDEP_TRUE@	source='tables.c' object='mpd-tables.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-tables.Po' tmpdepfile='$(DEPDIR)/mpd-tables.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-tables.obj `cygpath -w tables.c`
+
+mpd-tables.lo: tables.c
+@AMDEP_TRUE@	source='tables.c' object='mpd-tables.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-tables.Plo' tmpdepfile='$(DEPDIR)/mpd-tables.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-tables.lo `test -f 'tables.c' || echo '$(srcdir)/'`tables.c
+
+mpd-utils.o: utils.c
+@AMDEP_TRUE@	source='utils.c' object='mpd-utils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-utils.Po' tmpdepfile='$(DEPDIR)/mpd-utils.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c
+
+mpd-utils.obj: utils.c
+@AMDEP_TRUE@	source='utils.c' object='mpd-utils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-utils.Po' tmpdepfile='$(DEPDIR)/mpd-utils.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-utils.obj `cygpath -w utils.c`
+
+mpd-utils.lo: utils.c
+@AMDEP_TRUE@	source='utils.c' object='mpd-utils.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-utils.Plo' tmpdepfile='$(DEPDIR)/mpd-utils.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-utils.lo `test -f 'utils.c' || echo '$(srcdir)/'`utils.c
+
+mpd-path.o: path.c
+@AMDEP_TRUE@	source='path.c' object='mpd-path.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-path.Po' tmpdepfile='$(DEPDIR)/mpd-path.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-path.o `test -f 'path.c' || echo '$(srcdir)/'`path.c
+
+mpd-path.obj: path.c
+@AMDEP_TRUE@	source='path.c' object='mpd-path.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-path.Po' tmpdepfile='$(DEPDIR)/mpd-path.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-path.obj `cygpath -w path.c`
+
+mpd-path.lo: path.c
+@AMDEP_TRUE@	source='path.c' object='mpd-path.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-path.Plo' tmpdepfile='$(DEPDIR)/mpd-path.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-path.lo `test -f 'path.c' || echo '$(srcdir)/'`path.c
+
+mpd-mp3_decode.o: mp3_decode.c
+@AMDEP_TRUE@	source='mp3_decode.c' object='mpd-mp3_decode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-mp3_decode.Po' tmpdepfile='$(DEPDIR)/mpd-mp3_decode.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp3_decode.o `test -f 'mp3_decode.c' || echo '$(srcdir)/'`mp3_decode.c
+
+mpd-mp3_decode.obj: mp3_decode.c
+@AMDEP_TRUE@	source='mp3_decode.c' object='mpd-mp3_decode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-mp3_decode.Po' tmpdepfile='$(DEPDIR)/mpd-mp3_decode.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp3_decode.obj `cygpath -w mp3_decode.c`
+
+mpd-mp3_decode.lo: mp3_decode.c
+@AMDEP_TRUE@	source='mp3_decode.c' object='mpd-mp3_decode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-mp3_decode.Plo' tmpdepfile='$(DEPDIR)/mpd-mp3_decode.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-mp3_decode.lo `test -f 'mp3_decode.c' || echo '$(srcdir)/'`mp3_decode.c
+
+mpd-tag.o: tag.c
+@AMDEP_TRUE@	source='tag.c' object='mpd-tag.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-tag.Po' tmpdepfile='$(DEPDIR)/mpd-tag.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-tag.o `test -f 'tag.c' || echo '$(srcdir)/'`tag.c
+
+mpd-tag.obj: tag.c
+@AMDEP_TRUE@	source='tag.c' object='mpd-tag.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-tag.Po' tmpdepfile='$(DEPDIR)/mpd-tag.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-tag.obj `cygpath -w tag.c`
+
+mpd-tag.lo: tag.c
+@AMDEP_TRUE@	source='tag.c' object='mpd-tag.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-tag.Plo' tmpdepfile='$(DEPDIR)/mpd-tag.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-tag.lo `test -f 'tag.c' || echo '$(srcdir)/'`tag.c
+
+mpd-player.o: player.c
+@AMDEP_TRUE@	source='player.c' object='mpd-player.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-player.Po' tmpdepfile='$(DEPDIR)/mpd-player.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-player.o `test -f 'player.c' || echo '$(srcdir)/'`player.c
+
+mpd-player.obj: player.c
+@AMDEP_TRUE@	source='player.c' object='mpd-player.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-player.Po' tmpdepfile='$(DEPDIR)/mpd-player.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-player.obj `cygpath -w player.c`
+
+mpd-player.lo: player.c
+@AMDEP_TRUE@	source='player.c' object='mpd-player.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-player.Plo' tmpdepfile='$(DEPDIR)/mpd-player.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-player.lo `test -f 'player.c' || echo '$(srcdir)/'`player.c
+
+mpd-listen.o: listen.c
+@AMDEP_TRUE@	source='listen.c' object='mpd-listen.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-listen.Po' tmpdepfile='$(DEPDIR)/mpd-listen.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-listen.o `test -f 'listen.c' || echo '$(srcdir)/'`listen.c
+
+mpd-listen.obj: listen.c
+@AMDEP_TRUE@	source='listen.c' object='mpd-listen.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-listen.Po' tmpdepfile='$(DEPDIR)/mpd-listen.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-listen.obj `cygpath -w listen.c`
+
+mpd-listen.lo: listen.c
+@AMDEP_TRUE@	source='listen.c' object='mpd-listen.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-listen.Plo' tmpdepfile='$(DEPDIR)/mpd-listen.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-listen.lo `test -f 'listen.c' || echo '$(srcdir)/'`listen.c
+
+mpd-conf.o: conf.c
+@AMDEP_TRUE@	source='conf.c' object='mpd-conf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-conf.Po' tmpdepfile='$(DEPDIR)/mpd-conf.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-conf.o `test -f 'conf.c' || echo '$(srcdir)/'`conf.c
+
+mpd-conf.obj: conf.c
+@AMDEP_TRUE@	source='conf.c' object='mpd-conf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-conf.Po' tmpdepfile='$(DEPDIR)/mpd-conf.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-conf.obj `cygpath -w conf.c`
+
+mpd-conf.lo: conf.c
+@AMDEP_TRUE@	source='conf.c' object='mpd-conf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-conf.Plo' tmpdepfile='$(DEPDIR)/mpd-conf.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-conf.lo `test -f 'conf.c' || echo '$(srcdir)/'`conf.c
+
+mpd-ogg_decode.o: ogg_decode.c
+@AMDEP_TRUE@	source='ogg_decode.c' object='mpd-ogg_decode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-ogg_decode.Po' tmpdepfile='$(DEPDIR)/mpd-ogg_decode.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ogg_decode.o `test -f 'ogg_decode.c' || echo '$(srcdir)/'`ogg_decode.c
+
+mpd-ogg_decode.obj: ogg_decode.c
+@AMDEP_TRUE@	source='ogg_decode.c' object='mpd-ogg_decode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-ogg_decode.Po' tmpdepfile='$(DEPDIR)/mpd-ogg_decode.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ogg_decode.obj `cygpath -w ogg_decode.c`
+
+mpd-ogg_decode.lo: ogg_decode.c
+@AMDEP_TRUE@	source='ogg_decode.c' object='mpd-ogg_decode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-ogg_decode.Plo' tmpdepfile='$(DEPDIR)/mpd-ogg_decode.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-ogg_decode.lo `test -f 'ogg_decode.c' || echo '$(srcdir)/'`ogg_decode.c
+
+mpd-volume.o: volume.c
+@AMDEP_TRUE@	source='volume.c' object='mpd-volume.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-volume.Po' tmpdepfile='$(DEPDIR)/mpd-volume.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-volume.o `test -f 'volume.c' || echo '$(srcdir)/'`volume.c
+
+mpd-volume.obj: volume.c
+@AMDEP_TRUE@	source='volume.c' object='mpd-volume.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-volume.Po' tmpdepfile='$(DEPDIR)/mpd-volume.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-volume.obj `cygpath -w volume.c`
+
+mpd-volume.lo: volume.c
+@AMDEP_TRUE@	source='volume.c' object='mpd-volume.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-volume.Plo' tmpdepfile='$(DEPDIR)/mpd-volume.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-volume.lo `test -f 'volume.c' || echo '$(srcdir)/'`volume.c
+
+mpd-flac_decode.o: flac_decode.c
+@AMDEP_TRUE@	source='flac_decode.c' object='mpd-flac_decode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-flac_decode.Po' tmpdepfile='$(DEPDIR)/mpd-flac_decode.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-flac_decode.o `test -f 'flac_decode.c' || echo '$(srcdir)/'`flac_decode.c
+
+mpd-flac_decode.obj: flac_decode.c
+@AMDEP_TRUE@	source='flac_decode.c' object='mpd-flac_decode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-flac_decode.Po' tmpdepfile='$(DEPDIR)/mpd-flac_decode.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-flac_decode.obj `cygpath -w flac_decode.c`
+
+mpd-flac_decode.lo: flac_decode.c
+@AMDEP_TRUE@	source='flac_decode.c' object='mpd-flac_decode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-flac_decode.Plo' tmpdepfile='$(DEPDIR)/mpd-flac_decode.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-flac_decode.lo `test -f 'flac_decode.c' || echo '$(srcdir)/'`flac_decode.c
+
+mpd-audio.o: audio.c
+@AMDEP_TRUE@	source='audio.c' object='mpd-audio.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-audio.Po' tmpdepfile='$(DEPDIR)/mpd-audio.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audio.o `test -f 'audio.c' || echo '$(srcdir)/'`audio.c
+
+mpd-audio.obj: audio.c
+@AMDEP_TRUE@	source='audio.c' object='mpd-audio.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-audio.Po' tmpdepfile='$(DEPDIR)/mpd-audio.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audio.obj `cygpath -w audio.c`
+
+mpd-audio.lo: audio.c
+@AMDEP_TRUE@	source='audio.c' object='mpd-audio.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-audio.Plo' tmpdepfile='$(DEPDIR)/mpd-audio.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audio.lo `test -f 'audio.c' || echo '$(srcdir)/'`audio.c
+
+mpd-playerData.o: playerData.c
+@AMDEP_TRUE@	source='playerData.c' object='mpd-playerData.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-playerData.Po' tmpdepfile='$(DEPDIR)/mpd-playerData.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-playerData.o `test -f 'playerData.c' || echo '$(srcdir)/'`playerData.c
+
+mpd-playerData.obj: playerData.c
+@AMDEP_TRUE@	source='playerData.c' object='mpd-playerData.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-playerData.Po' tmpdepfile='$(DEPDIR)/mpd-playerData.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-playerData.obj `cygpath -w playerData.c`
+
+mpd-playerData.lo: playerData.c
+@AMDEP_TRUE@	source='playerData.c' object='mpd-playerData.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-playerData.Plo' tmpdepfile='$(DEPDIR)/mpd-playerData.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-playerData.lo `test -f 'playerData.c' || echo '$(srcdir)/'`playerData.c
+
+mpd-stats.o: stats.c
+@AMDEP_TRUE@	source='stats.c' object='mpd-stats.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-stats.Po' tmpdepfile='$(DEPDIR)/mpd-stats.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-stats.o `test -f 'stats.c' || echo '$(srcdir)/'`stats.c
+
+mpd-stats.obj: stats.c
+@AMDEP_TRUE@	source='stats.c' object='mpd-stats.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-stats.Po' tmpdepfile='$(DEPDIR)/mpd-stats.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-stats.obj `cygpath -w stats.c`
+
+mpd-stats.lo: stats.c
+@AMDEP_TRUE@	source='stats.c' object='mpd-stats.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-stats.Plo' tmpdepfile='$(DEPDIR)/mpd-stats.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-stats.lo `test -f 'stats.c' || echo '$(srcdir)/'`stats.c
+
+mpd-myfprintf.o: myfprintf.c
+@AMDEP_TRUE@	source='myfprintf.c' object='mpd-myfprintf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-myfprintf.Po' tmpdepfile='$(DEPDIR)/mpd-myfprintf.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-myfprintf.o `test -f 'myfprintf.c' || echo '$(srcdir)/'`myfprintf.c
+
+mpd-myfprintf.obj: myfprintf.c
+@AMDEP_TRUE@	source='myfprintf.c' object='mpd-myfprintf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-myfprintf.Po' tmpdepfile='$(DEPDIR)/mpd-myfprintf.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-myfprintf.obj `cygpath -w myfprintf.c`
+
+mpd-myfprintf.lo: myfprintf.c
+@AMDEP_TRUE@	source='myfprintf.c' object='mpd-myfprintf.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-myfprintf.Plo' tmpdepfile='$(DEPDIR)/mpd-myfprintf.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-myfprintf.lo `test -f 'myfprintf.c' || echo '$(srcdir)/'`myfprintf.c
+
+mpd-sig_handlers.o: sig_handlers.c
+@AMDEP_TRUE@	source='sig_handlers.c' object='mpd-sig_handlers.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-sig_handlers.Po' tmpdepfile='$(DEPDIR)/mpd-sig_handlers.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-sig_handlers.o `test -f 'sig_handlers.c' || echo '$(srcdir)/'`sig_handlers.c
+
+mpd-sig_handlers.obj: sig_handlers.c
+@AMDEP_TRUE@	source='sig_handlers.c' object='mpd-sig_handlers.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-sig_handlers.Po' tmpdepfile='$(DEPDIR)/mpd-sig_handlers.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-sig_handlers.obj `cygpath -w sig_handlers.c`
+
+mpd-sig_handlers.lo: sig_handlers.c
+@AMDEP_TRUE@	source='sig_handlers.c' object='mpd-sig_handlers.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-sig_handlers.Plo' tmpdepfile='$(DEPDIR)/mpd-sig_handlers.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-sig_handlers.lo `test -f 'sig_handlers.c' || echo '$(srcdir)/'`sig_handlers.c
+
+mpd-decode.o: decode.c
+@AMDEP_TRUE@	source='decode.c' object='mpd-decode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-decode.Po' tmpdepfile='$(DEPDIR)/mpd-decode.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-decode.o `test -f 'decode.c' || echo '$(srcdir)/'`decode.c
+
+mpd-decode.obj: decode.c
+@AMDEP_TRUE@	source='decode.c' object='mpd-decode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-decode.Po' tmpdepfile='$(DEPDIR)/mpd-decode.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-decode.obj `cygpath -w decode.c`
+
+mpd-decode.lo: decode.c
+@AMDEP_TRUE@	source='decode.c' object='mpd-decode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-decode.Plo' tmpdepfile='$(DEPDIR)/mpd-decode.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-decode.lo `test -f 'decode.c' || echo '$(srcdir)/'`decode.c
+
+mpd-log.o: log.c
+@AMDEP_TRUE@	source='log.c' object='mpd-log.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-log.Po' tmpdepfile='$(DEPDIR)/mpd-log.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-log.o `test -f 'log.c' || echo '$(srcdir)/'`log.c
+
+mpd-log.obj: log.c
+@AMDEP_TRUE@	source='log.c' object='mpd-log.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-log.Po' tmpdepfile='$(DEPDIR)/mpd-log.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-log.obj `cygpath -w log.c`
+
+mpd-log.lo: log.c
+@AMDEP_TRUE@	source='log.c' object='mpd-log.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-log.Plo' tmpdepfile='$(DEPDIR)/mpd-log.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-log.lo `test -f 'log.c' || echo '$(srcdir)/'`log.c
+
+mpd-char_conv.o: char_conv.c
+@AMDEP_TRUE@	source='char_conv.c' object='mpd-char_conv.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-char_conv.Po' tmpdepfile='$(DEPDIR)/mpd-char_conv.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-char_conv.o `test -f 'char_conv.c' || echo '$(srcdir)/'`char_conv.c
+
+mpd-char_conv.obj: char_conv.c
+@AMDEP_TRUE@	source='char_conv.c' object='mpd-char_conv.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-char_conv.Po' tmpdepfile='$(DEPDIR)/mpd-char_conv.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-char_conv.obj `cygpath -w char_conv.c`
+
+mpd-char_conv.lo: char_conv.c
+@AMDEP_TRUE@	source='char_conv.c' object='mpd-char_conv.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-char_conv.Plo' tmpdepfile='$(DEPDIR)/mpd-char_conv.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-char_conv.lo `test -f 'char_conv.c' || echo '$(srcdir)/'`char_conv.c
+
+mpd-audiofile_decode.o: audiofile_decode.c
+@AMDEP_TRUE@	source='audiofile_decode.c' object='mpd-audiofile_decode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-audiofile_decode.Po' tmpdepfile='$(DEPDIR)/mpd-audiofile_decode.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audiofile_decode.o `test -f 'audiofile_decode.c' || echo '$(srcdir)/'`audiofile_decode.c
+
+mpd-audiofile_decode.obj: audiofile_decode.c
+@AMDEP_TRUE@	source='audiofile_decode.c' object='mpd-audiofile_decode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-audiofile_decode.Po' tmpdepfile='$(DEPDIR)/mpd-audiofile_decode.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audiofile_decode.obj `cygpath -w audiofile_decode.c`
+
+mpd-audiofile_decode.lo: audiofile_decode.c
+@AMDEP_TRUE@	source='audiofile_decode.c' object='mpd-audiofile_decode.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/mpd-audiofile_decode.Plo' tmpdepfile='$(DEPDIR)/mpd-audiofile_decode.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpd_CFLAGS) $(CFLAGS) -c -o mpd-audiofile_decode.lo `test -f 'audiofile_decode.c' || echo '$(srcdir)/'`audiofile_decode.c
 CCDEPMODE = @CCDEPMODE@
 
 mostlyclean-libtool:
diff --git a/src/audiofile_decode.c b/src/audiofile_decode.c
new file mode 100644
index 000000000..ac14a4fdb
--- /dev/null
+++ b/src/audiofile_decode.c
@@ -0,0 +1,131 @@
+/* the Music Player Daemon (MPD)
+ * (c)2003 by Warren Dukes (shank@mercury.chem.pitt.edu)
+ * This project's homepage is: http://www.musicpd.org
+ * 
+ * libaudiofile (wave) support added by Eric Wong <normalperson@yhbt.net>
+ * 
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifdef HAVE_AUDIOFILE
+
+#include "audiofile_decode.h"
+#include "command.h"
+#include "utils.h"
+#include "audio.h"
+#include "log.h"
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <audiofile.h>
+
+int getAudiofileTotalTime(char * file)
+{
+	int time;
+	AFfilehandle af_fp = afOpenFile(file, "r", NULL);
+	if(af_fp == AF_NULL_FILEHANDLE) {
+		return -1;
+	}
+	time = (int)
+		((double)afGetFrameCount(af_fp,AF_DEFAULT_TRACK)
+		 /afGetRate(af_fp,AF_DEFAULT_TRACK));
+	afCloseFile(af_fp);
+	return time;
+}
+
+int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
+{
+	int fs, frame_count;
+	AFfilehandle af_fp;
+		
+	af_fp = afOpenFile(dc->file,"r", NULL);
+	if(af_fp == AF_NULL_FILEHANDLE) {
+		ERROR1("failed to open %s\n",dc->file);
+		return -1;
+	}
+
+	afGetSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &af->bits);
+	af->sampleRate = (int)afGetRate(af_fp, AF_DEFAULT_TRACK);
+	af->channels = afGetChannels(af_fp,AF_DEFAULT_TRACK);
+	
+	frame_count = afGetFrameCount(af_fp,AF_DEFAULT_TRACK);
+	
+	cb->totalTime = ((float)frame_count/(float)af->sampleRate);
+	
+	if (af->bits != 8 && af->bits != 16) {
+		ERROR2("Only 8 and 16-bit files are supported. %s is %i-bit\n",
+			dc->file,af->bits);
+		afCloseFile(af_fp);
+		return -1;
+	}
+	
+	fs = (int)afGetFrameSize(af_fp, AF_DEFAULT_TRACK,1);
+
+	dc->state = DECODE_STATE_DECODE;
+	dc->start = 0;
+	{
+		int ret, eof = 0, current = 0;
+		unsigned char chunk[CHUNK_SIZE];
+
+		while(!eof) {
+			if(dc->seek) {
+				cb->end = 0;
+				cb->wrap = 0;
+				current = dc->seekWhere * af->sampleRate;
+				afSeekFrame(af_fp, AF_DEFAULT_TRACK,current);
+				
+				dc->seek = 0;
+			}
+
+			ret = afReadFrames(af_fp, AF_DEFAULT_TRACK, chunk, CHUNK_SIZE/fs);
+			if(ret<=0) eof = 1;
+			else {
+				while(cb->begin==cb->end && cb->wrap &&
+						!dc->stop && !dc->seek){
+					usleep(1000);
+				}
+				if(dc->stop) break;
+				else if(dc->seek) continue;
+				
+				memcpy(cb->chunks[cb->end],chunk,CHUNK_SIZE);
+				cb->chunkSize[cb->end] = CHUNK_SIZE;
+				
+				current += ret;
+				cb->times[cb->end] = (float)current/(float)af->sampleRate;
+				
+				++cb->end;
+				
+				if(cb->end>=BUFFERED_CHUNKS) {
+					cb->end = 0;
+					cb->wrap = 1;
+				}
+			}
+		}
+
+		if(dc->seek) dc->seek = 0;
+
+		if(dc->stop) {
+			dc->state = DECODE_STATE_STOP;
+			dc->stop = 0;
+		}
+		else dc->state = DECODE_STATE_STOP;
+	}
+	afCloseFile(af_fp);
+
+	return 0;
+}
+
+#endif /* HAVE_AUDIOFILE */
diff --git a/src/audiofile_decode.h b/src/audiofile_decode.h
new file mode 100644
index 000000000..7e60d0c2d
--- /dev/null
+++ b/src/audiofile_decode.h
@@ -0,0 +1,32 @@
+/* the Music Player Daemon (MPD)
+ * (c)2003 by Warren Dukes (shank@mercury.chem.pitt.edu)
+ * This project's homepage is: http://www.musicpd.org
+ * 
+ * libaudiofile (wave) support added by Eric Wong <normalperson@yhbt.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef AUDIOFILE_DECODE_H
+#define AUDIOFILE_DECODE_H
+
+#ifdef HAVE_AUDIOFILE
+
+#include "playerData.h"
+
+int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc);
+int getAudiofileTotalTime(char * file);
+
+#endif /* HAVE_AUDIOFILE */
+#endif /* AUDIOFILE_DECODE_H */
diff --git a/src/char_conv.c b/src/char_conv.c
new file mode 100644
index 000000000..132ae150c
--- /dev/null
+++ b/src/char_conv.c
@@ -0,0 +1,99 @@
+/* the Music Player Daemon (MPD)
+ * (c)2003 by Warren Dukes (shank@mercury.chem.pitt.edu)
+ * This project's homepage is: http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "char_conv.h"
+
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+
+#ifdef HAVE_ICONV
+#include <iconv.h>
+iconv_t char_conv_iconv;
+char * char_conv_to = NULL;
+char * char_conv_from = NULL;
+#endif
+
+#define BUFFER_SIZE	1024
+
+int setCharSetConversion(char * to, char * from) {
+#ifdef HAVE_ICONV
+	if(char_conv_to && strcmp(to,char_conv_to)==0 &&
+			char_conv_from && strcmp(from,char_conv_from)==0)
+	{ 
+		return 0;
+	}
+
+	closeCharSetConversion();
+
+	if((char_conv_iconv = iconv_open(to,from))==(iconv_t)(-1)) return -1;
+
+	char_conv_to = strdup(to);
+	char_conv_from = strdup(from);
+
+	return 0;
+#endif
+	return -1;
+}
+
+char * convStrDup(char * string) {
+#ifdef HAVE_ICONV
+	char buffer[BUFFER_SIZE];
+	int inleft = strlen(string);
+	char * ret;
+	int outleft;
+	int retlen = 0;
+	size_t err;
+	char * bufferPtr;
+
+	if(!char_conv_to) return NULL;
+
+	ret = strdup("");
+
+	while(inleft) {
+		bufferPtr = buffer;
+		outleft = BUFFER_SIZE;
+		err = iconv(char_conv_iconv,&string,&inleft,&bufferPtr,
+					&outleft);
+		if(outleft==BUFFER_SIZE || (err<0 && errno!=E2BIG)) {
+			free(ret);
+			return NULL;
+		}
+
+		ret = realloc(ret,retlen+BUFFER_SIZE-outleft+1);
+		strncpy(&(ret[retlen]),buffer,BUFFER_SIZE-outleft);
+		retlen+=BUFFER_SIZE-outleft;
+		ret[retlen] = '\0';
+	}
+
+	return ret;
+#endif
+	return NULL;
+}
+
+void closeCharSetConversion() {
+#ifdef HAVE_ICONV
+	if(char_conv_to) {
+		iconv_close(char_conv_iconv);
+		free(char_conv_to);
+		free(char_conv_from);
+		char_conv_to = NULL;
+		char_conv_from = NULL;
+	}
+#endif
+}
diff --git a/src/char_conv.h b/src/char_conv.h
new file mode 100644
index 000000000..518d00bb5
--- /dev/null
+++ b/src/char_conv.h
@@ -0,0 +1,28 @@
+/* the Music Player Daemon (MPD)
+ * (c)2003 by Warren Dukes (shank@mercury.chem.pitt.edu)
+ * This project's homepage is: http://www.musicpd.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef CHAR_CONV_H
+#define CHAR_CONV_H
+
+int setCharSetConversion(char * to, char * from);
+
+char * convStrDup(char * string);
+
+void closeCharSetConversion();
+
+#endif
diff --git a/src/command.c b/src/command.c
index b96f6628b..d6ff317d5 100644
--- a/src/command.c
+++ b/src/command.c
@@ -31,421 +31,417 @@
 #include <string.h>
 #include <unistd.h>
 
-#define COMMAND_PLAY		"play"
-#define COMMAND_STOP		"stop"
-#define COMMAND_PAUSE		"pause"
-#define COMMAND_STATUS		"status"
-#define COMMAND_KILL		"kill"
-#define COMMAND_CLOSE		"close"
-#define COMMAND_ADD		"add"
-#define COMMAND_DELETE		"delete"
-#define COMMAND_PLAYLIST	"playlist"
-#define COMMAND_SHUFFLE		"shuffle"
-#define COMMAND_CLEAR		"clear"
-#define COMMAND_SAVE		"save"
-#define COMMAND_LOAD		"load"
-#define COMMAND_LS		"ls"
-#define COMMAND_LSINFO		"lsinfo"
-#define COMMAND_RM		"rm"
-#define COMMAND_PLAYLISTINFO	"playlistinfo"
-#define COMMAND_FIND		"find"
-#define COMMAND_SEARCH		"search"
-#define COMMAND_UPDATE		"update"
-#define COMMAND_NEXT		"next"
-#define COMMAND_PREVIOUS	"previous"
-#define COMMAND_LISTALL		"listall"
-#define COMMAND_VOLUME		"volume"
-#define COMMAND_REPEAT		"repeat"
-#define COMMAND_RANDOM		"random"
-#define COMMAND_STATS		"stats"
-#define COMMAND_CLEAR_ERROR	"clearerror"
-#define COMMAND_LIST		"list"
-#define COMMAND_MOVE		"move"
-#define COMMAND_SWAP		"swap"
-#define COMMAND_SEEK		"seek"
-
-#define COMMAND_STATUS_VOLUME		"volume"
-#define COMMAND_STATUS_STATE		"state"
-#define COMMAND_STATUS_REPEAT		"repeat"
-#define COMMAND_STATUS_RANDOM		"random"
-#define COMMAND_STATUS_PLAYLIST		"playlist"
-#define COMMAND_STATUS_PLAYLIST_LENGTH	"playlistlength"
-#define COMMAND_STATUS_SONG		"song"
-#define COMMAND_STATUS_TIME		"time"
-#define COMMAND_STATUS_ERROR		"error"
+#define COMMAND_PLAY            "play"
+#define COMMAND_STOP            "stop"
+#define COMMAND_PAUSE           "pause"
+#define COMMAND_STATUS          "status"
+#define COMMAND_KILL            "kill"
+#define COMMAND_CLOSE           "close"
+#define COMMAND_ADD             "add"
+#define COMMAND_DELETE          "delete"
+#define COMMAND_PLAYLIST        "playlist"
+#define COMMAND_SHUFFLE         "shuffle"
+#define COMMAND_CLEAR           "clear"
+#define COMMAND_SAVE            "save"
+#define COMMAND_LOAD            "load"
+#define COMMAND_LS              "ls"
+#define COMMAND_LSINFO          "lsinfo"
+#define COMMAND_RM              "rm"
+#define COMMAND_PLAYLISTINFO    "playlistinfo"
+#define COMMAND_FIND            "find"
+#define COMMAND_SEARCH          "search"
+#define COMMAND_UPDATE          "update"
+#define COMMAND_NEXT            "next"
+#define COMMAND_PREVIOUS        "previous"
+#define COMMAND_LISTALL         "listall"
+#define COMMAND_VOLUME          "volume"
+#define COMMAND_REPEAT          "repeat"
+#define COMMAND_RANDOM          "random"
+#define COMMAND_STATS           "stats"
+#define COMMAND_CLEAR_ERROR     "clearerror"
+#define COMMAND_LIST            "list"
+#define COMMAND_MOVE            "move"
+#define COMMAND_SWAP            "swap"
+#define COMMAND_SEEK            "seek"
+
+#define COMMAND_STATUS_VOLUME           "volume"
+#define COMMAND_STATUS_STATE            "state"
+#define COMMAND_STATUS_REPEAT           "repeat"
+#define COMMAND_STATUS_RANDOM           "random"
+#define COMMAND_STATUS_PLAYLIST         "playlist"
+#define COMMAND_STATUS_PLAYLIST_LENGTH  "playlistlength"
+#define COMMAND_STATUS_SONG             "song"
+#define COMMAND_STATUS_TIME             "time"
+#define COMMAND_STATUS_BITRATE          "bitrate"
+#define COMMAND_STATUS_ERROR            "error"
+
+/* if min: -1 don't check args *
+ * if max: -1 no max args      */
+typedef struct _CommandEntry {
+	char * cmd;
+        int min;
+        int max;
+	int (*handler)(FILE * fp, int argArrayLength, char ** argArray);
+} CommandEntry;
+
+int handlePlay(FILE * fp, int argArrayLength, char ** argArray) {
+        int song = -1;
+        char * test;
+
+        if(argArrayLength==2) {
+                song = strtol(argArray[1],&test,10);
+                if(*test!='\0') {
+                        myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
+                        return -1;
+                }
+        }
+        return playPlaylist(fp,song,1);
+}
+
+int handleStop(FILE * fp, int argArrayLength, char ** argArray) {
+        return stopPlaylist(fp);
+}
+
+int handlePause(FILE * fp, int argArrayLength, char ** argArray) {
+        return playerPause(fp);
+}
 
 int commandStatus(FILE * fp,int argArrayLength, char ** argArray) {
-	char * state = NULL;
-	if(argArrayLength!=1) {
-		myfprintf(fp,"%s Wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-		return -1;
-	}
-	
-	playPlaylistIfPlayerStopped();
-	switch(getPlayerState()) {
-		case PLAYER_STATE_STOP:
-			state = strdup(COMMAND_STOP);
-			break;
-		case PLAYER_STATE_PAUSE:
-			state = strdup(COMMAND_PAUSE);
-			break;
-		case PLAYER_STATE_PLAY:
-			state = strdup(COMMAND_PLAY);
-			break;
-	}
-
-	myfprintf(fp,"%s: %i\n",COMMAND_STATUS_VOLUME,getVolumeLevel());
-	myfprintf(fp,"%s: %i\n",COMMAND_STATUS_REPEAT,getPlaylistRepeatStatus());
-	myfprintf(fp,"%s: %i\n",COMMAND_STATUS_RANDOM,getPlaylistRandomStatus());
-	myfprintf(fp,"%s: %li\n",COMMAND_STATUS_PLAYLIST,getPlaylistVersion());
-	myfprintf(fp,"%s: %i\n",COMMAND_STATUS_PLAYLIST_LENGTH,getPlaylistLength());
-	myfprintf(fp,"%s: %s\n",COMMAND_STATUS_STATE,state);
-
-	if(getPlayerState()!=PLAYER_STATE_STOP) {
-		myfprintf(fp,"%s: %i\n",COMMAND_STATUS_SONG,getPlaylistCurrentSong());
-		myfprintf(fp,"%s: %i:%i\n",COMMAND_STATUS_TIME,getPlayerElapsedTime(),getPlayerTotalTime());
-	}
-
-	if(getPlayerError()!=PLAYER_ERROR_NOERROR) {
-		myfprintf(fp,"%s: %s\n",COMMAND_STATUS_ERROR,getPlayerErrorStr());
-	}
-
-	free(state);
-
-	return 0;
+        char * state = NULL;
+
+        playPlaylistIfPlayerStopped();
+        switch(getPlayerState()) {
+                case PLAYER_STATE_STOP:
+                        state = strdup(COMMAND_STOP);
+                        break;
+                case PLAYER_STATE_PAUSE:
+                        state = strdup(COMMAND_PAUSE);
+                        break;
+                case PLAYER_STATE_PLAY:
+                        state = strdup(COMMAND_PLAY);
+                        break;
+        }
+
+        myfprintf(fp,"%s: %i\n",COMMAND_STATUS_VOLUME,getVolumeLevel());
+        myfprintf(fp,"%s: %i\n",COMMAND_STATUS_REPEAT,getPlaylistRepeatStatus());
+        myfprintf(fp,"%s: %i\n",COMMAND_STATUS_RANDOM,getPlaylistRandomStatus());
+        myfprintf(fp,"%s: %li\n",COMMAND_STATUS_PLAYLIST,getPlaylistVersion());
+        myfprintf(fp,"%s: %i\n",COMMAND_STATUS_PLAYLIST_LENGTH,getPlaylistLength());
+        myfprintf(fp,"%s: %s\n",COMMAND_STATUS_STATE,state);
+
+        if(getPlayerState()!=PLAYER_STATE_STOP) {
+                myfprintf(fp,"%s: %i\n",COMMAND_STATUS_SONG,getPlaylistCurrentSong());
+                myfprintf(fp,"%s: %i:%i\n",COMMAND_STATUS_TIME,getPlayerElapsedTime(),getPlayerTotalTime());
+                myfprintf(fp,"%s: %li\n",COMMAND_STATUS_BITRATE,getPlayerBitRate(),getPlayerTotalTime());
+        }
+
+        if(getPlayerError()!=PLAYER_ERROR_NOERROR) {
+                myfprintf(fp,"%s: %s\n",COMMAND_STATUS_ERROR,getPlayerErrorStr());
+        }
+
+        free(state);
+
+        return 0;
 }
 
-int processCommand(FILE * fp, int argArrayLength, char ** argArray) {
-	if(argArrayLength==0) {
-		return 0;
-	}
-
-	if(0==strcmp(argArray[0],COMMAND_PLAY)) {
-		int song = -1;
-		char * test;
-		if(argArrayLength>2) {
-			myfprintf(fp,"%s too many arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		if(argArrayLength==2) {
-			song = strtol(argArray[1],&test,10);
-			if(*test!='\0') {
-				myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
-				return -1;
-			}
-		}
-		return playPlaylist(fp,song,1);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_STOP)) {
-		if(argArrayLength!=1) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return stopPlaylist(fp);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_PAUSE)) {
-		if(argArrayLength!=1) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return playerPause(fp);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_STATUS)) {
-		return commandStatus(fp,argArrayLength,argArray);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_KILL)) {
-		return COMMAND_RETURN_KILL;
-	}
-	else if(0==strcmp(argArray[0],COMMAND_CLOSE)) {
-		return COMMAND_RETURN_CLOSE;
-	}
-	else if(0==strcmp(argArray[0],COMMAND_ADD)) {
-		if(argArrayLength!=2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return addToPlaylist(fp,argArray[1]);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_SAVE)) {
-		if(argArrayLength!=2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return savePlaylist(fp,argArray[1]);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_RM)) {
-		if(argArrayLength!=2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return deletePlaylist(fp,argArray[1]);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_DELETE)) {
-		int song;
-		char * test;
-		if(argArrayLength!=2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		song = strtol(argArray[1],&test,10);
-		if(*test!='\0') {
-			myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
-			return -1;
-		}
-		return deleteFromPlaylist(fp,song);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_MOVE)) {
-		int from;
-		int to;
-		char * test;
-		if(argArrayLength!=3) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		from = strtol(argArray[1],&test,10);
-		if(*test!='\0') {
-			myfprintf(fp,"%s \"%s\" is not a integer\n",
-					COMMAND_RESPOND_ERROR,argArray[1]);
-			return -1;
-		}
-		to = strtol(argArray[2],&test,10);
-		if(*test!='\0') {
-			myfprintf(fp,"%s \"%s\" is not a integer\n",
-					COMMAND_RESPOND_ERROR,argArray[2]);
-			return -1;
-		}
-		return moveSongInPlaylist(fp,from,to);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_SWAP)) {
-		int song1;
-		int song2;
-		char * test;
-		if(argArrayLength!=3) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		song1 = strtol(argArray[1],&test,10);
-		if(*test!='\0') {
-			myfprintf(fp,"%s \"%s\" is not a integer\n",
-					COMMAND_RESPOND_ERROR,argArray[1]);
-			return -1;
-		}
-		song2 = strtol(argArray[2],&test,10);
-		if(*test!='\0') {
-			myfprintf(fp,"%s \"%s\" is not a integer\n",
-					COMMAND_RESPOND_ERROR,argArray[2]);
-			return -1;
-		}
-		return swapSongsInPlaylist(fp,song1,song2);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_SEEK)) {
-		int song;
-		int time;
-		char * test;
-		if(argArrayLength!=3) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
+int handleKill(FILE * fp, int argArrayLength, char ** argArray) {
+        return COMMAND_RETURN_KILL;
+}
+
+int handleClose(FILE * fp, int argArrayLength, char ** argArray) {
+        return COMMAND_RETURN_CLOSE;
+}
+
+int handleAdd(FILE * fp, int argArrayLength, char ** argArray) {
+        return addToPlaylist(fp,argArray[1]);
+}
+
+int handleDelete(FILE * fp, int argArrayLength, char ** argArray) {
+        int song;
+        char * test;
+
+        song = strtol(argArray[1],&test,10);
+        if(*test!='\0') {
+                myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
+                return -1;
+        }
+        return deleteFromPlaylist(fp,song); 
+}
+
+int handlePlaylist(FILE * fp, int argArrayLength, char ** argArray) {
+        return showPlaylist(fp);
+}
+
+int handleShuffle(FILE * fp, int argArrayLength, char ** argArray) {
+        return shufflePlaylist(fp);
+}
+
+int handleClear(FILE * fp, int argArrayLength, char ** argArray) {
+        return clearPlaylist(fp);
+}
+
+int handleSave(FILE * fp, int argArrayLength, char ** argArray) {
+        return savePlaylist(fp,argArray[1]);
+}
+
+int handleLoad(FILE * fp, int argArrayLength, char ** argArray) {
+        return loadPlaylist(fp,argArray[1]);
+}
+
+int handleLs(FILE * fp, int argArrayLength, char ** argArray) {
+        if(argArrayLength==1) {
+                if(ls(fp,NULL)<0) return -1;
+                else return lsPlaylists(fp,"");
+        }
+        else {
+                if(ls(fp,argArray[1])<0) return -1;
+                else return lsPlaylists(fp,argArray[1]);
+        }
+}
+
+int handleLsInfo(FILE * fp, int argArrayLength, char ** argArray) {
+        if(argArrayLength==1) {
+                if(printDirectoryInfo(fp,NULL)<0) return -1;
+                else return lsPlaylists(fp,"");
+        }
+        else {
+                if(printDirectoryInfo(fp,argArray[1])<0) return -1;
+                else return lsPlaylists(fp,argArray[1]);
+        }
+}
+
+int handleRm(FILE * fp, int argArrayLength, char ** argArray) {
+        return deletePlaylist(fp,argArray[1]);
+}
+
+int handlePlaylistInfo(FILE * fp, int argArrayLength, char ** argArray) {
+        int song = -1;
+        char * test;
+
+	if(argArrayLength == 2) {
 		song = strtol(argArray[1],&test,10);
-		if(*test!='\0') {
-			myfprintf(fp,"%s \"%s\" is not a integer\n",
-					COMMAND_RESPOND_ERROR,argArray[1]);
-			return -1;
-		}
-		time = strtol(argArray[2],&test,10);
-		if(*test!='\0') {
-			myfprintf(fp,"%s \"%s\" is not a integer\n",
-					COMMAND_RESPOND_ERROR,argArray[2]);
-			return -1;
-		}
-		return seekSongInPlaylist(fp,song,time);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_VOLUME)) {
-		int change;
-		char * test;
-		if(argArrayLength!=2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		change = strtol(argArray[1],&test,10);
-		if(*test!='\0') {
-			myfprintf(fp,"%s need a integer\n",COMMAND_RESPOND_ERROR);
-			return -1;
-		}
-		return changeVolumeLevel(fp,change);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_REPEAT)) {
-		int status;
-		char * test;
-		if(argArrayLength!=2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		status = strtol(argArray[1],&test,10);
-		if(*test!='\0') {
-			myfprintf(fp,"%s need a integer\n",COMMAND_RESPOND_ERROR);
-			return -1;
-		}
-		return setPlaylistRepeatStatus(fp,status);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_RANDOM)) {
-		int status;
-		char * test;
-		if(argArrayLength!=2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		status = strtol(argArray[1],&test,10);
-		if(*test!='\0') {
-			myfprintf(fp,"%s need a integer\n",COMMAND_RESPOND_ERROR);
-			return -1;
-		}
-		return setPlaylistRandomStatus(fp,status);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_PLAYLISTINFO)) {
-		int song = -1;
-		char * test;
-		if(argArrayLength>2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		if(argArrayLength==2) {
-			song = strtol(argArray[1],&test,10);
-			if(*test!='\0') {
-				myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
-				return -1;
-			}
-		}
-		return playlistInfo(fp,song);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_PLAYLIST)) {
-		if(argArrayLength!=1) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return showPlaylist(fp);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_SHUFFLE)) {
-		if(argArrayLength!=1) {
-			myfprintf(fp,"%s too many arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return shufflePlaylist(fp);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_CLEAR)) {
-		if(argArrayLength!=1) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return clearPlaylist(fp);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_LOAD)) {
-		if(argArrayLength!=2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return loadPlaylist(fp,argArray[1]);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_LS)) {
-		if(argArrayLength>2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		if(argArrayLength==1) {
-			if(ls(fp,NULL)<0) return -1;
-			else return lsPlaylists(fp,"");
-		}
-		else {
-			if(ls(fp,argArray[1])<0) return -1;
-			else return lsPlaylists(fp,argArray[1]);
-		}
-	}
-	else if(0==strcmp(argArray[0],COMMAND_LSINFO)) {
-		if(argArrayLength>2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		if(argArrayLength==1) {
-			if(printDirectoryInfo(fp,NULL)<0) return -1;
-			else return lsPlaylists(fp,"");
-		}
-		else {
-			if(printDirectoryInfo(fp,argArray[1])<0) return -1;
-			else return lsPlaylists(fp,argArray[1]);
-		}
-	}
-	else if(0==strcmp(argArray[0],COMMAND_FIND)) {
-		if(argArrayLength!=3) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return findAndPrintSongsInTable(fp,argArray[1],argArray[2]);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_SEARCH)) {
-		if(argArrayLength!=3) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return searchForSongsInTable(fp,argArray[1],argArray[2]);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_UPDATE)) {
-		if(argArrayLength!=1) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return updateMp3Directory(fp);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_NEXT)) {
-		if(argArrayLength!=1) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return nextSongInPlaylist(fp);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_PREVIOUS)) {
-		if(argArrayLength!=1) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return previousSongInPlaylist(fp);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_LISTALL)) {
-		char * directory = NULL;
-		if(argArrayLength>2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		if(argArrayLength==2) directory = argArray[1];
-		return printAllIn(fp,directory);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_LIST)) {
-		char * arg1 = NULL;
-		if(argArrayLength>3 || argArrayLength<2) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		if(argArrayLength==3) arg1 = argArray[2];
-		return printAllKeysOfTable(fp,argArray[1],arg1);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_STATS)) {
-		if(argArrayLength!=1) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
-		}
-		return printStats(fp);
-	}
-	else if(0==strcmp(argArray[0],COMMAND_CLEAR_ERROR)) {
-		if(argArrayLength!=1) {
-			myfprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-			return -1;
+                if(*test!='\0') {
+                        myfprintf(fp,"%s need a positive integer\n",COMMAND_RESPOND_ERROR);
+                        return -1;
+                }
+        }
+        return playlistInfo(fp,song);
+}
+
+int handleFind(FILE * fp, int argArrayLength, char ** argArray) {
+        return findAndPrintSongsInTable(fp,argArray[1],argArray[2]);
+}
+
+int handleSearch(FILE * fp, int argArrayLength, char ** argArray) {
+        return searchForSongsInTable(fp,argArray[1],argArray[2]);
+}
+
+int handleUpdate(FILE * fp, int argArrayLength, char ** argArray) {
+        return updateMp3Directory(fp);
+}
+
+int handleNext(FILE * fp, int argArrayLength, char ** argArray) {
+        return nextSongInPlaylist(fp);
+}
+
+int handlePrevious(FILE * fp, int argArrayLength, char ** argArray) {
+        return previousSongInPlaylist(fp);
+}
+
+int handleListAll(FILE * fp, int argArrayLength, char ** argArray) {
+        char * directory = NULL;
+
+        if(argArrayLength==2) directory = argArray[1];
+        return printAllIn(fp,directory);
+}
+
+int handleVolume(FILE * fp, int argArrayLength, char ** argArray) {
+        int change;
+        char * test;
+
+        change = strtol(argArray[1],&test,10);
+        if(*test!='\0') {
+                myfprintf(fp,"%s need an integer\n",COMMAND_RESPOND_ERROR);
+                return -1;
+        }
+        return changeVolumeLevel(fp,change);
+}
+
+int handleRepeat(FILE * fp, int argArrayLength, char ** argArray) {
+        int status;
+        char * test;
+
+        status = strtol(argArray[1],&test,10);
+        if(*test!='\0') {
+                myfprintf(fp,"%s need an integer\n",COMMAND_RESPOND_ERROR);
+                return -1;
+        }
+        return setPlaylistRepeatStatus(fp,status);
+}
+
+int handleRandom(FILE * fp, int argArrayLength, char ** argArray) {
+        int status;
+        char * test;
+
+        status = strtol(argArray[1],&test,10);
+        if(*test!='\0') {
+                myfprintf(fp,"%s need an integer\n",COMMAND_RESPOND_ERROR);
+                return -1;
+        }
+        return setPlaylistRandomStatus(fp,status);
+}
+
+int handleStats(FILE * fp, int argArrayLength, char ** argArray) {
+        return printStats(fp);
+}
+
+int handleClearError(FILE * fp, int argArrayLength, char ** argArray) {
+
+        clearPlayerError();
+        return 0;
+}
+
+int handleList(FILE * fp, int argArrayLength, char ** argArray) {
+        char * arg1 = NULL;
+
+        if(argArrayLength==3) arg1 = argArray[2];
+        return printAllKeysOfTable(fp,argArray[1],arg1);
+}
+
+int handleMove(FILE * fp, int argArrayLength, char ** argArray) {
+        int from;
+        int to;
+        char * test;
+
+        from = strtol(argArray[1],&test,10);
+        if(*test!='\0') {
+                myfprintf(fp,"%s \"%s\" is not a integer\n",
+                                COMMAND_RESPOND_ERROR,argArray[1]);
+                return -1;
+        }
+        to = strtol(argArray[2],&test,10);
+        if(*test!='\0') {
+                myfprintf(fp,"%s \"%s\" is not a integer\n",
+                                COMMAND_RESPOND_ERROR,argArray[2]);
+                return -1;
+        }
+        return moveSongInPlaylist(fp,from,to);
+}
+
+int handleSwap(FILE * fp, int argArrayLength, char ** argArray) {
+        int song1;
+        int song2;
+        char * test;
+
+        song1 = strtol(argArray[1],&test,10);
+        if(*test!='\0') {
+                myfprintf(fp,"%s \"%s\" is not a integer\n",
+                                COMMAND_RESPOND_ERROR,argArray[1]);
+                return -1;
+        }
+        song2 = strtol(argArray[2],&test,10);
+        if(*test!='\0') {
+                myfprintf(fp,"%s \"%s\" is not a integer\n",
+                                COMMAND_RESPOND_ERROR,argArray[2]);
+                return -1;
+        }
+        return swapSongsInPlaylist(fp,song1,song2);
+}
+
+int handleSeek(FILE * fp, int argArrayLength, char ** argArray) {
+        int song;
+        int time;
+        char * test;
+
+        song = strtol(argArray[1],&test,10);
+        if(*test!='\0') {
+                myfprintf(fp,"%s \"%s\" is not a integer\n",
+                                COMMAND_RESPOND_ERROR,argArray[1]);
+                return -1;
+        }
+        time = strtol(argArray[2],&test,10);
+        if(*test!='\0') {
+                myfprintf(fp,"%s \"%s\" is not a integer\n",
+                                COMMAND_RESPOND_ERROR,argArray[2]);
+                return -1;
+        }
+        return seekSongInPlaylist(fp,song,time);
+}
+
+/* call string, handlerFunc                                         *
+ * int (*handler)(FILE * fp, int argArrayLength, char ** argArray); */
+CommandEntry commandTable[] = {
+        {COMMAND_PLAY        ,  0,  1, handlePlay},
+        {COMMAND_STOP        ,  0,  0, handleStop},
+        {COMMAND_PAUSE       ,  0,  0, handlePause},
+        {COMMAND_STATUS      ,  0,  0, commandStatus},
+        {COMMAND_KILL        , -1, -1, handleKill},
+        {COMMAND_CLOSE       , -1, -1, handleClose},
+        {COMMAND_ADD         ,  1,  1, handleAdd},
+        {COMMAND_DELETE      ,  1,  1, handleDelete},
+        {COMMAND_PLAYLIST    ,  0,  0, handlePlaylist},
+        {COMMAND_SHUFFLE     ,  0,  0, handleShuffle},
+        {COMMAND_CLEAR       ,  0,  0, handleClear},
+        {COMMAND_SAVE        ,  1,  1, handleSave},
+        {COMMAND_LOAD        ,  1,  1, handleLoad},
+        {COMMAND_LS          ,  0,  1, handleLs},
+        {COMMAND_LSINFO      ,  0,  1, handleLsInfo},
+        {COMMAND_RM          ,  1,  1, handleRm},
+        {COMMAND_PLAYLISTINFO,  0,  1, handlePlaylistInfo},
+        {COMMAND_FIND        ,  2,  2, handleFind},
+        {COMMAND_SEARCH      ,  2,  2, handleSearch},
+        {COMMAND_UPDATE      ,  0,  0, handleUpdate},
+        {COMMAND_NEXT        ,  0,  0, handleNext},
+        {COMMAND_PREVIOUS    ,  0,  0, handlePrevious},
+        {COMMAND_LISTALL     ,  0,  1, handleListAll},
+        {COMMAND_VOLUME      ,  1,  1, handleVolume},
+        {COMMAND_REPEAT      ,  1,  1, handleRepeat},
+        {COMMAND_RANDOM      ,  1,  1, handleRandom},
+        {COMMAND_STATS       ,  0,  0, handleStats},
+        {COMMAND_CLEAR_ERROR ,  0,  0, handleClearError},
+        {COMMAND_LIST        ,  1,  2, handleList},
+        {COMMAND_MOVE        ,  2,  2, handleMove},
+        {COMMAND_SWAP        ,  2,  2, handleSwap},
+        {COMMAND_SEEK        ,  2,  2, handleSeek}
+};
+
+const int nCommands = sizeof(commandTable) / sizeof(commandTable[0]);
+
+int checkArgc(int index, FILE *fp, int argc, char** argArray) {
+        int min = commandTable[index].min + 1;
+        int max = commandTable[index].max + 1;
+
+	if (min == 0) return 0;
+
+        if (min == max && max != argc) {
+                myfprintf(fp,"%s Wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
+                return -1;
+        }
+        else if (argc < min) {
+                myfprintf(fp,"%s too few arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
+                return -1;
+        }
+        else if (argc > max && max /* != 0 */) {
+                myfprintf(fp,"%s too many arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
+                return -1;
+        }
+        else return 0;
+}
+
+int processCommand(FILE * fp, int argArrayLength, char ** argArray) {
+        int i = 0;
+
+        if(argArrayLength == 0) return 0;
+
+        for (i = 0; i < nCommands; i++) {
+                if (0 == strcmp(argArray[0],commandTable[i].cmd)) {
+			if (checkArgc(i,fp,argArrayLength,argArray)) return -1;
+                        return commandTable[i].handler(fp, argArrayLength, 
+							argArray);
 		}
-		clearPlayerError();
-		return 0;
-	}
-	else {
-		myfprintf(fp,"%s Unknown command \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
-		return -1;
-	}
-
-	return 0;
+        }
+
+        myfprintf(fp,"%s Unknown command \"%s\"\n",COMMAND_RESPOND_ERROR,
+			argArray[0]);
+        return -1;
 }
diff --git a/src/decode.c b/src/decode.c
index 8f10b0f37..0611d37b0 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -18,6 +18,7 @@
 
 #include "decode.h"
 #include "player.h"
+#include "playerData.h"
 #include "utils.h"
 
 #include "audio.h"
@@ -30,6 +31,9 @@
 #ifdef HAVE_FLAC
 #include "flac_decode.h"
 #endif
+#ifdef HAVE_AUDIOFILE
+#include "audiofile_decode.h"
+#endif
 #include "path.h"
 #include "log.h"
 
@@ -98,6 +102,7 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
 	}
 
 	pc->elapsedTime = 0;
+	pc->bitRate = 0;
 	pc->totalTime = cb->totalTime;
 
 	return 0;
@@ -125,6 +130,7 @@ void decodeSeek(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
 			cb->begin = 0;
 			dc->seek = 1;
 			pc->elapsedTime = dc->seekWhere;
+			pc->bitRate = 0;
 			while(decode_pid>0 && dc->seek) usleep(10);
 		}
 	}
@@ -181,6 +187,11 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
 				case DECODE_TYPE_FLAC:
 					dc->error = flac_decode(cb,af,dc);
 					break;
+#endif
+#ifdef HAVE_AUDIOFILE
+				case DECODE_TYPE_AUDIOFILE:
+					dc->error = audiofile_decode(cb,af,dc);
+					break;
 #endif
 				default:
 					dc->error = DECODE_ERROR_UNKTYPE;
@@ -196,7 +207,7 @@ int decoderInit(PlayerControl * pc, Buffer * cb, AudioFormat *af,
 				dc->stop = 0;
 			}
 			else if(dc->seek) dc->start = 1;
-			else usleep(10);
+			else usleep(1000);
 		}
 
 		exit(0);
@@ -279,6 +290,7 @@ void decode() {
 				cb->begin!=cb->next)
 			{
 				pc->elapsedTime = cb->times[cb->begin];
+				pc->bitRate = cb->bitRate[cb->begin];
 				playAudio(cb->chunks[cb->begin],
 					cb->chunkSize[cb->begin]);
 				cb->begin++;
diff --git a/src/decode.h b/src/decode.h
index 1cac0db92..87a0bd48e 100644
--- a/src/decode.h
+++ b/src/decode.h
@@ -25,6 +25,7 @@
 #define DECODE_TYPE_MP3		0
 #define DECODE_TYPE_OGG		1
 #define DECODE_TYPE_FLAC	2
+#define DECODE_TYPE_AUDIOFILE 	3
 
 #define DECODE_STATE_STOP	0
 #define DECODE_STATE_DECODE	1
diff --git a/src/directory.c b/src/directory.c
index da978f206..d21bb03a8 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -526,31 +526,36 @@ void initMp3Directory() {
 }
 
 Song * getSong(char * file) {
-	static char * c;
-	static char * shortname;
-	static char dir[MAXPATHLEN];
-	static char dup[MAXPATHLEN];
-	static Directory * directory;
-	static void * song;
-
-	if(strlen(file)>MAXPATHLEN) return NULL;
-	
-	dir[0] = '\0';
-	strcpy(dup,file);
-	c = strtok(dup,"/");
+	void * song;
+	Directory * directory;
+	char * shortname = NULL;
+	char * dir = NULL;
+	char * dup = strdup(file);
+	char * c = strtok(dup,"/");
+
 	while(c) {
 		shortname = c;
 		c = strtok(NULL,"/");
-		if(c) {
-			strcat(dir,shortname);
-			strcat(dir,"/");
+	}
+
+	if(shortname!=dup) {
+		for(c = dup; c < shortname-1; c++) {
+			if(*c=='\0') *c = '/';
 		}
+		dir = dup;
 	}
 
-	if(!(directory = getSubDirectory(mp3rootDirectory,dir))) return NULL;
+	if(!(directory = getSubDirectory(mp3rootDirectory,dir))) {
+		free(dup);
+		return NULL;
+	}
 
-	if(!findInList(directory->songs,shortname,&song)) return NULL;
+	if(!findInList(directory->songs,shortname,&song)) {
+		free(dup);
+		return NULL;
+	}
 
+	free(dup);
 	return (Song *)song;
 }
 
diff --git a/src/flac_decode.c b/src/flac_decode.c
index c890db28d..f6ffd7690 100644
--- a/src/flac_decode.c
+++ b/src/flac_decode.c
@@ -175,7 +175,7 @@ int flacSendChunk(FlacData * data) {
 	while(data->cb->begin==data->cb->end && data->cb->wrap && 
 		!data->dc->stop && !data->dc->seek)  
 	{
-		usleep(10);
+		usleep(1000);
 	}
 
 	if(data->dc->stop) return -1;
@@ -184,6 +184,7 @@ int flacSendChunk(FlacData * data) {
 	memcpy(data->cb->chunks[data->cb->end],data->chunk,CHUNK_SIZE);
 	data->cb->chunkSize[data->cb->end] = data->chunk_length;
 	data->cb->times[data->cb->end] = data->time;
+	data->cb->bitRate[data->cb->end] = 0;
 
 	data->cb->end++;
 	if(data->cb->end>=BUFFERED_CHUNKS) {
diff --git a/src/interface.c b/src/interface.c
index 7fe76a819..bb7cb1d16 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -45,6 +45,7 @@
 #define INTERFACE_MAX_BUFFER_LENGTH	MAXPATHLEN+1024
 #define INTERFACE_LIST_MODE_BEGIN	"command_list_begin"
 #define INTERFACE_LIST_MODE_END		"command_list_end"
+#define INTERFACE_MAX_OUT_BUFFER_LENGTH	4096
 
 int interface_max_connections;
 int interface_timeout;
@@ -65,12 +66,16 @@ typedef struct _Interface {
 	int expired; /* set whether this interface should be closed on next
 			check of old interfaces */
 	int num; /* interface number */
+	char outBuffer[INTERFACE_MAX_OUT_BUFFER_LENGTH];
+	int outBuflen;
 } Interface;
 
 Interface * interfaces = NULL;
 
 void flushInterfaceBuffer(Interface * interface);
 
+void printInterfaceOutBuffer(Interface * interface);
+
 void openInterface(Interface * interface, int fd) {
 	int flags;
 	
@@ -90,9 +95,12 @@ void openInterface(Interface * interface, int fd) {
 	interface->bufferList = NULL;
 	interface->expired = 0;
 	interface->outputBufferSize = 0;
+	interface->outBuflen = 0;
 	unblockSignals();
 
-	myfprintf(interface->fp,"%s %s %s\n",COMMAND_RESPOND_OK,GREETING,VERSION);
+	myfprintf(interface->fp,"%s %s %s\n",COMMAND_RESPOND_OK,GREETING,
+			VERSION);
+	printInterfaceOutBuffer(interface);
 }
 
 void closeInterface(Interface * interface) {
@@ -205,6 +213,7 @@ int interfaceReadInput(Interface * interface) {
 							interface->expired) {
 						closeInterface(interface);
 					}
+					printInterfaceOutBuffer(interface);
 
 					freeList(interface->commandList);
 					interface->commandList = NULL;
@@ -246,6 +255,7 @@ int interfaceReadInput(Interface * interface) {
 							interface->expired) {
 						closeInterface(interface);
 					}
+					printInterfaceOutBuffer(interface);
 				}
 			}
 			freeArgArray(argArray,argArrayLength);
@@ -260,28 +270,30 @@ int interfaceReadInput(Interface * interface) {
 	return 1;
 }
 
-void addInterfacesReadyToReadAndListenSocketToFdSet(fd_set * fds) {
+void addInterfacesReadyToReadAndListenSocketToFdSet(fd_set * fds, int * fdmax) {
 	int i;
 
 	FD_ZERO(fds);
 	FD_SET(listenSocket,fds);
+	if(*fdmax<listenSocket) *fdmax = listenSocket;
 
 	for(i=0;i<interface_max_connections;i++) {
 		if(interfaces[i].open && !interfaces[i].expired && !interfaces[i].bufferList) {
 			FD_SET(interfaces[i].fd,fds);
+			if(*fdmax<interfaces[i].fd) *fdmax = interfaces[i].fd;
 		}
 	}
 }
 
-void addInterfacesForBufferFlushToFdSet(fd_set * fds) {
+void addInterfacesForBufferFlushToFdSet(fd_set * fds, int * fdmax) {
 	int i;
 
 	FD_ZERO(fds);
-	FD_SET(listenSocket,fds);
 
 	for(i=0;i<interface_max_connections;i++) {
 		if(interfaces[i].open && !interfaces[i].expired && interfaces[i].bufferList) {
 			FD_SET(interfaces[i].fd,fds);
+			if(*fdmax<interfaces[i].fd) *fdmax = interfaces[i].fd;
 		}
 	}
 }
@@ -312,14 +324,15 @@ int doIOForInterfaces() {
 	struct timeval tv;
 	int i;
 	int selret;
+	int fdmax = 0;
 
 	tv.tv_sec = 1;
 	tv.tv_usec = 0;
 
-	addInterfacesReadyToReadAndListenSocketToFdSet(&rfds);
-	addInterfacesForBufferFlushToFdSet(&wfds);
+	addInterfacesReadyToReadAndListenSocketToFdSet(&rfds,&fdmax);
+	addInterfacesForBufferFlushToFdSet(&wfds,&fdmax);
 
-	while((selret = select(FD_SETSIZE,&rfds,&wfds,NULL,&tv))) {
+	while((selret = select(fdmax+1,&rfds,&wfds,NULL,&tv))) {
 		if(FD_ISSET(listenSocket,&rfds)) getConnections(listenSocket);
 		if(selret<0 && errno==EINTR) break;
 		else if(selret<0) {
@@ -340,8 +353,9 @@ int doIOForInterfaces() {
 		}
 		tv.tv_sec = 0;
 		tv.tv_usec = 0;
-		addInterfacesReadyToReadAndListenSocketToFdSet(&rfds);
-		addInterfacesForBufferFlushToFdSet(&wfds);
+		fdmax = 0;
+		addInterfacesReadyToReadAndListenSocketToFdSet(&rfds,&fdmax);
+		addInterfacesForBufferFlushToFdSet(&wfds,&fdmax);
 	}
 
 	return 1;
@@ -474,9 +488,11 @@ void flushAllInterfaceBuffers() {
 
 int interfacePrintWithFD(int fd,char * buffer) {
 	int i;
-	int ret;
+	int buflen;
+	int copylen;
+	Interface * interface;
 
-	if(!strlen(buffer)) return -1;
+	if(!(buflen = strlen(buffer))) return -1;
 
 	for(i=0;i<interface_max_connections;i++) {
 		if(interfaces[i].fd==fd) break;
@@ -485,50 +501,96 @@ int interfacePrintWithFD(int fd,char * buffer) {
 	/* if fd isn't found or interfaces is going to be closed, do nothing */
 	if(i==interface_max_connections || interfaces[i].expired) return -1;
 
-	if(interfaces[i].bufferList) {
-		interfaces[i].outputBufferSize+=sizeof(ListNode);
-		interfaces[i].outputBufferSize+=strlen(buffer)+1;
-		if(interfaces[i].outputBufferSize>interface_max_output_buffer_size) {
+	interface = interfaces+i;
+
+	while(buflen>0) {
+		copylen = buflen>
+			INTERFACE_MAX_OUT_BUFFER_LENGTH-interface->outBuflen?
+			INTERFACE_MAX_OUT_BUFFER_LENGTH-interface->outBuflen:
+			buflen;
+		memcpy(interface->outBuffer+interface->outBuflen,buffer,
+			copylen);
+		buflen-=copylen;
+		interface->outBuflen+=copylen;
+		buffer+=copylen;
+		if(interface->outBuflen>=INTERFACE_MAX_OUT_BUFFER_LENGTH) {
+			printInterfaceOutBuffer(interface);
+		}
+	}
+
+	return 0;
+}
+
+void printInterfaceOutBuffer(Interface * interface) {
+	char * buffer;
+	int ret;
+
+	if(!interface->open || interface->expired || !interface->outBuflen) {
+		return;
+	}
+
+	if(interface->bufferList) {
+		interface->outputBufferSize+=sizeof(ListNode);
+		interface->outputBufferSize+=interface->outBuflen+1;
+		if(interface->outputBufferSize>
+				interface_max_output_buffer_size)
+ 		{
 			ERROR3("interface %i: output buffer size (%lli) is "
 					"larger than the max (%lli)\n",
-					interfaces[i].num,
-					interfaces[i].outputBufferSize,
+					interface->num,
+					interface->outputBufferSize,
 					interface_max_output_buffer_size);
 			/* cause interface to close */
-			freeList(interfaces[i].bufferList);
-			interfaces[i].bufferList = NULL;
-			interfaces[i].expired = 1;
-			return 0;
+			freeList(interface->bufferList);
+			interface->bufferList = NULL;
+			interface->expired = 1;
 		}
 		else {
-			insertInListWithoutKey(interfaces[i].bufferList,(void *)strdup(buffer));
-			flushInterfaceBuffer(&interfaces[i]);
+			buffer = malloc(interface->outBuflen+1);
+			memcpy(buffer,interface->outBuffer,interface->outBuflen);
+			buffer[interface->outBuflen] = '\0';
+			insertInListWithoutKey(interface->bufferList,(void *)buffer);
+			flushInterfaceBuffer(interface);
 		}
 	}
 	else {
-		if((ret = write(fd,buffer,strlen(buffer)))<0) {
+		if((ret = write(interface->fd,interface->outBuffer,
+				interface->outBuflen))<0) 
+		{
 			if(errno==EAGAIN || errno==EINTR) {
-				interfaces[i].bufferList = makeList(free);
-				insertInListWithoutKey(interfaces[i].bufferList,(void *)strdup(buffer));
+				buffer = malloc(interface->outBuflen+1);
+				memcpy(buffer,interface->outBuffer,
+						interface->outBuflen);
+				buffer[interface->outBuflen] = '\0';
+				interface->bufferList = makeList(free);
+				insertInListWithoutKey(interface->bufferList,
+						(void *)buffer);
 			}
 			else {
-				DEBUG1("interface %i: problems writing\n",i);
-				interfaces[i].expired = 1;
-				return 0;
+				DEBUG1("interface %i: problems writing\n",
+						interface->num);
+				interface->expired = 1;
+				return;
 			}
 		}
-		else if(ret<strlen(buffer)) {
-			interfaces[i].bufferList = makeList(free);
-			insertInListWithoutKey(interfaces[i].bufferList,(void *)strdup(&buffer[ret]));
+		else if(ret<interface->outBuflen) {
+			buffer = malloc(interface->outBuflen-ret+1);
+			memcpy(buffer,interface->outBuffer+ret,
+					interface->outBuflen-ret);
+			buffer[interface->outBuflen-ret] = '\0';
+			interface->bufferList = makeList(free);
+			insertInListWithoutKey(interface->bufferList,buffer);
 		}
 		/* if we needed to create buffer, initialize bufferSize info */
-		if(interfaces[i].bufferList) {
-			DEBUG1("interface %i: buffer created\n",i);
-			interfaces[i].outputBufferSize = sizeof(List);
-			interfaces[i].outputBufferSize+=sizeof(ListNode);
-			interfaces[i].outputBufferSize+=strlen((char *)interfaces[i].bufferList->firstNode->data)+1;
+		if(interface->bufferList) {
+			DEBUG1("interface %i: buffer created\n",interface->num);
+			interface->outputBufferSize = sizeof(List);
+			interface->outputBufferSize+=sizeof(ListNode);
+			interface->outputBufferSize+=strlen(
+					(char *)interface->bufferList->
+					firstNode->data)+1;
 		}
 	}
 
-	return 0;
+	interface->outBuflen = 0;
 }
diff --git a/src/ls.c b/src/ls.c
index 576ba6e2f..bce77b3ad 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -82,36 +82,40 @@ int lsPlaylists(FILE * fp, char * path) {
 	DIR * dir;
 	struct stat st;
 	struct dirent * ent;
-	char * cLast;
-	char * cNext;
 	char * dup;
 	char s[MAXPATHLEN+1];
 	List * list = NULL;
 	ListNode * node = NULL;
 	char * actualPath = rpp2app(path);
+	int actlen = strlen(actualPath)+1;
+	int maxlen = MAXPATHLEN-actlen;
+	int suflen = strlen(PLAYLIST_FILE_SUFFIX)+1;
+	int suff;
+
+	if(actlen>MAXPATHLEN-1) return 0;
 
 	if((dir = opendir(actualPath))==NULL) return 0;
 
+	s[MAXPATHLEN] = '\0';
+	strcpy(s,actualPath);
+	strcat(s,"/");
+
 	while((ent = readdir(dir))) {
-		if(ent->d_name[0]=='.') continue; /* hide hidden stuff */
-		snprintf(s,MAXPATHLEN,"%s/%s",actualPath,ent->d_name);
-		if(stat(s,&st)==0) {
-			if(S_ISREG(st.st_mode)) {
-				dup = strdup(ent->d_name);
-				cNext = cLast = strtok(dup,".");
-				while((cNext = strtok(NULL,"."))) cLast = cNext;
-				if(cLast && 0==strcmp(cLast,
-						PLAYLIST_FILE_SUFFIX)) 
-				{
+		dup = ent->d_name;
+		if(dup[0]!='.' && 
+				(suff=strlen(dup)-suflen)>0 && 
+				dup[suff]=='.' &&
+				strcmp(dup+suff+1,PLAYLIST_FILE_SUFFIX)==0) 
+		{
+			strncpy(s+actlen,ent->d_name,maxlen);
+			if(stat(s,&st)==0) {
+				if(S_ISREG(st.st_mode)) {
 					if(list==NULL) list = makeList(NULL);
-					memset(dup,0,strlen(ent->d_name));
-					strncpy(dup,ent->d_name,
-						strlen(ent->d_name)-
-						strlen(PLAYLIST_FILE_SUFFIX)-1);
-					//myfprintf(fp,"playlist: %s\n",dup);
+					dup = strdup(ent->d_name);
+					dup[suff] = '\0';
 					insertInList(list,dup,NULL);
+					free(dup);
 				}
-				free(dup);
 			}
 		}
 	}
@@ -151,6 +155,9 @@ time_t isMusic(char * file) {
 #ifdef HAVE_MAD
 	if((ret = isMp3(file)>0)) return ret;
 #endif
+#ifdef HAVE_AUDIOFILE
+	if((ret = isWave(file)>0)) return ret;
+#endif
 
 	return ret;
 }
@@ -184,6 +191,33 @@ time_t isPlaylist(char * file) {
 	return 0;
 }
 
+time_t isWave(char * file) {
+	struct stat st;
+	char * actualFile = file;
+
+	if(actualFile[0]!='/') actualFile = rmp2amp(file);
+
+	if(stat(actualFile,&st)==0) {
+		if(S_ISREG(st.st_mode)) {
+			char * dup;
+			char * cLast;
+			char * cNext;
+			int ret = 0;
+			dup = strdup(file);
+			cNext = cLast = strtok(dup,".");
+			while((cNext = strtok(NULL,"."))) cLast = cNext;
+			if(cLast && 0==strcasecmp(cLast,"wav")) {
+				ret = st.st_mtime;
+			}
+			free(dup);
+			return ret;
+		}
+		else return 0;
+	}
+
+	return 0;
+}
+
 time_t isFlac(char * file) {
 	struct stat st;
 	char * actualFile = file;
diff --git a/src/ls.h b/src/ls.h
index 1b4f78612..547656674 100644
--- a/src/ls.h
+++ b/src/ls.h
@@ -32,6 +32,8 @@ time_t isOgg(char * file);
 
 time_t isFlac(char * file);
 
+time_t isWave(char * file);
+
 time_t isMusic(char * file);
 
 time_t isDir(char * name);
diff --git a/src/main.c b/src/main.c
index 5b642eac3..7b8cae9af 100644
--- a/src/main.c
+++ b/src/main.c
@@ -67,11 +67,12 @@ void usage(char * argv[]) {
 			SYSTEM_CONFIG_FILE_LOCATION);
 	ERROR0("\n");
 	ERROR0("options:\n");
-	ERROR0("   --help        this usage statement\n");
-	ERROR0("   --no-daemon   don't detach from console\n");
-	ERROR0("   --create-db   (re)create database\n");
-	ERROR0("   --verbose     verbose logging\n");
-	ERROR0("   --version     prints version information\n");
+	ERROR0("   --help           this usage statement\n");
+	ERROR0("   --no-daemon      don't detach from console\n");
+	ERROR0("   --create-db      force (re)creation database\n");
+	ERROR0("   --no-create-db   don't create database\n");
+	ERROR0("   --verbose        verbose logging\n");
+	ERROR0("   --version        prints version information\n");
 }
 
 void version() {
@@ -106,6 +107,10 @@ void parseOptions(int argc, char ** argv, Options * options) {
 					options->createDB = 1;
 					argcLeft--;
 				}
+				else if(strcmp(argv[i],"--no-create-db")==0) {
+					options->createDB = -1;
+					argcLeft--;
+				}
 				else if(strcmp(argv[i],"--verbose")==0) {
 					logLevel = LOG_LEVEL_DEBUG;
 					argcLeft--;
@@ -174,6 +179,18 @@ int main(int argc, char * argv[]) {
 	FILE * out;
 	FILE * err;
 	Options options;
+	int i;
+
+	for(i=0;i<FD_SETSIZE;i++) {
+		switch(i) {
+		case STDIN_FILENO:
+		case STDOUT_FILENO:
+		case STDERR_FILENO:
+			break;
+		default:
+			close(i);
+		}
+	}
 
 	initConf();
 
@@ -309,6 +326,11 @@ int main(int argc, char * argv[]) {
 	}
 	else strncpy(directorydb,options.dbFile,MAXPATHLEN);
 	if(options.createDB || readDirectoryDB()<0) {
+		if(options.createDB<0) {
+			ERROR0("can't open db file and using \"--no-create-db\""
+					" command line option\n");
+			exit(-1);
+		}
 		initMp3Directory();
 		if(writeDirectoryDB()<0) {
 			ERROR0("problem opening db for reading or writing\n");
@@ -323,9 +345,12 @@ int main(int argc, char * argv[]) {
 	initStats();
 	initPlaylist();
 
+	close(STDIN_FILENO);
 	if(options.daemon) {
-		int pid = fork();
+		int pid;
 
+		fflush(NULL);
+		pid = fork();
 		if(pid>0) _exit(0);
 		else if(pid<0) {
 			ERROR0("problems fork'ing for daemon!\n");
@@ -337,6 +362,11 @@ int main(int argc, char * argv[]) {
 			exit(-1);
 		}
 
+		if(setsid()<0) {
+			ERROR0("problems setsid'ing\n");
+			exit(-1);
+		}
+
 		if(close(STDOUT_FILENO)) {
 			fprintf(err,"problems closing stdout : %s\n",
 					strerror(errno));
@@ -362,13 +392,20 @@ int main(int argc, char * argv[]) {
 		}
 
 		myfprintfStdLogMode(out,err);
+
+		fflush(NULL);
+		pid = fork();
+		if(pid>0) _exit(0);
+		else if(pid<0) {
+			ERROR0("problems fork'ing for daemon!\n");
+			exit(-1);
+		}
 	}
 	else {
 		fclose(out);
 		fclose(err);
 	}
 
-	fclose(stdin);
 	/* lets redirect stdin to dev null as a work around for libao bug */
 	{
 		int fd = open("/dev/null",O_RDONLY);
diff --git a/src/mp3_decode.c b/src/mp3_decode.c
index df2575327..67e4cb83d 100644
--- a/src/mp3_decode.c
+++ b/src/mp3_decode.c
@@ -118,6 +118,7 @@ typedef struct _mp3DecodeData {
 	long maxFrames;
 	long currentFrame;
 	int flush;
+	unsigned long bitRate;
 } mp3DecodeData;
 
 void initMp3DecodeData(mp3DecodeData * data) {
@@ -325,6 +326,22 @@ void mp3DecodeDataFinalize(mp3DecodeData * data) {
 	if(data->times) free(data->times);
 }
 
+/* this is primarily used for getting total time for tags */
+int getMp3TotalTime(char * file) {
+	mp3DecodeData data;
+	int ret;
+
+	while(!(data.fp = fopen(file,"r")) && errno==EINTR);
+	if(!data.fp) return -1;
+
+	initMp3DecodeData(&data);
+	if(decodeFirstFrame(&data)<0) ret = -1;
+	else ret = data.totalTime;
+	mp3DecodeDataFinalize(&data);
+
+	return ret;
+}
+
 int openMp3(char * file, mp3DecodeData * data) {
 	if((data->fp = fopen(file,"r"))<=0) {
 		ERROR1("problems opening \"%s\"\n",file);
@@ -341,7 +358,7 @@ int openMp3(char * file, mp3DecodeData * data) {
 
 int mp3ChildSendData(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
 	while(cb->begin==cb->end && cb->wrap && !dc->stop && !dc->seek) 
-		usleep(10);
+		usleep(1000);
 	if(dc->stop) return -1;
 	/* just for now, so it doesn't hang */
 	if(dc->seek) return 0;
@@ -349,6 +366,7 @@ int mp3ChildSendData(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
 
 	memcpy(cb->chunks[cb->end],data->outputBuffer,CHUNK_SIZE);
 	cb->chunkSize[cb->end] = data->outputPtr-data->outputBuffer;
+	cb->bitRate[cb->end] = data->bitRate/1000;
 	cb->times[cb->end] = data->elapsedTime;
 
 	cb->end++;
@@ -369,6 +387,7 @@ int mp3Read(mp3DecodeData * data, Buffer * cb, DecoderControl * dc) {
 			data->highestFrame<data->maxFrames) 
 	{
 		mad_timer_add(&data->timer,(data->frame).header.duration);
+		data->bitRate = (data->frame).header.bitrate;
 		data->frameOffset[data->currentFrame] = 
 				data->currentOffset;
 		if(data->stream.this_frame!=NULL) {
diff --git a/src/mp3_decode.h b/src/mp3_decode.h
index 1d0248819..0de0eadd9 100644
--- a/src/mp3_decode.h
+++ b/src/mp3_decode.h
@@ -19,8 +19,15 @@
 #ifndef MP3_DECODE_H
 #define MP3_DECODE_H
 
+#ifdef HAVE_MAD
+
 #include "playerData.h"
 
+/* this is primarily used in tag.c */
+int getMp3TotalTime(char * file);
+
 int mp3_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc);
 
 #endif
+
+#endif
diff --git a/src/ogg_decode.c b/src/ogg_decode.c
index f6e3812af..79e6bb118 100644
--- a/src/ogg_decode.c
+++ b/src/ogg_decode.c
@@ -61,6 +61,8 @@ int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
 		int eof = 0;
 		long ret;
 		char chunk[CHUNK_SIZE];
+		long bitRate = 0;
+		long test;
 
 		while(!eof) {
 			if(dc->seek) {
@@ -76,13 +78,17 @@ int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
 				while(cb->begin==cb->end && cb->wrap &&
 						!dc->stop && !dc->seek)
 				{
-					usleep(10);
+					usleep(1000);
 				}
 				if(dc->stop) break;
 				else if(dc->seek) continue;
 				memcpy(cb->chunks[cb->end],chunk,CHUNK_SIZE);
 				cb->chunkSize[cb->end] = ret;
 				cb->times[cb->end] = ov_time_tell(&vf);
+				if((test = ov_bitrate_instant(&vf))>0) {
+					bitRate = test/1000;
+				}
+				cb->bitRate[cb->end] = bitRate;
 				cb->end++;
 				if(cb->end>=BUFFERED_CHUNKS) {
 					cb->end = 0;
diff --git a/src/player.c b/src/player.c
index ecd8aa2e0..2436fe04b 100644
--- a/src/player.c
+++ b/src/player.c
@@ -30,6 +30,7 @@
 #include "directory.h"
 #include "volume.h"
 #include "playerData.h"
+#include "char_conv.h"
 
 #include <stdio.h>
 #include <sys/types.h>
@@ -97,6 +98,7 @@ int playerInit() {
 		closeMp3Directory();
 		closeTables();
 		finishVolume();
+		closeCharSetConversion();
 
 		while(1) {
 			if(pc->play) decode();
@@ -115,7 +117,7 @@ int playerInit() {
 				pc->queueLockState = PLAYER_QUEUE_UNLOCKED;
 				pc->unlockQueue = 0;
 			}
-			else usleep(10);
+			else usleep(1000);
 		}
 
 		exit(0);
@@ -154,6 +156,9 @@ int playerPlay(FILE * fp, char * file) {
 #endif
 #ifdef HAVE_FLAC	
 	else if(isFlac(file)) pc->decodeType = DECODE_TYPE_FLAC;
+#endif
+#ifdef HAVE_AUDIOFILE
+	else if(isWave(file)) pc->decodeType = DECODE_TYPE_AUDIOFILE;
 #endif
 	else {
 		strcpy(pc->erroredFile,pc->file);
@@ -215,6 +220,10 @@ int getPlayerElapsedTime() {
 	return (int)(getPlayerData()->playerControl.elapsedTime+0.5);
 }
 
+unsigned long getPlayerBitRate() {
+	return getPlayerData()->playerControl.bitRate;
+}
+
 int getPlayerTotalTime() {
 	return (int)(getPlayerData()->playerControl.totalTime+0.5);
 }
@@ -281,6 +290,9 @@ int queueSong(char * file) {
 #endif
 #ifdef HAVE_FLAC	
 		else if(isFlac(file)) pc->decodeType = DECODE_TYPE_FLAC;
+#endif
+#ifdef HAVE_AUDIOFILE
+		else if(isWave(file)) pc->decodeType = DECODE_TYPE_AUDIOFILE;
 #endif
 		else return -1;
 		pc->queueState = PLAYER_QUEUE_FULL;
diff --git a/src/player.h b/src/player.h
index c0db470fb..c145abc06 100644
--- a/src/player.h
+++ b/src/player.h
@@ -54,6 +54,7 @@ typedef struct _PlayerControl {
 	int state;
 	int closeAudio;
 	int error;
+	unsigned long bitRate;
 	float totalTime;
 	float elapsedTime;
 	char file[MAXPATHLEN+1];
@@ -84,6 +85,8 @@ int getPlayerTotalTime();
 
 int getPlayerElapsedTime();
 
+unsigned long getPlayerBitRate();
+
 int getPlayerState();
 
 void clearPlayerError();
diff --git a/src/playerData.h b/src/playerData.h
index 6c86c2808..b3603416c 100644
--- a/src/playerData.h
+++ b/src/playerData.h
@@ -31,6 +31,7 @@ extern int buffered_before_play;
 typedef struct _Buffer {
 	char chunks[BUFFERED_CHUNKS][CHUNK_SIZE];
 	uint_16 chunkSize[BUFFERED_CHUNKS];
+	uint_16 bitRate[BUFFERED_CHUNKS];
 	float times[BUFFERED_CHUNKS];
 	int begin;
 	int end;
diff --git a/src/playlist.c b/src/playlist.c
index 062623f5a..972aebe13 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -77,6 +77,7 @@ int playlist_max_length;
 int playlist_stopOnError;
 int playlist_errorCount = 0;
 int playlist_queueError;
+int playlist_noGoToNext = 0;
 
 int playlist_saveAbsolutePaths;
 
@@ -452,6 +453,10 @@ int addToPlaylist(FILE * fp, char * file) {
 		return -1;
 	}
 
+	return addSongToPlaylist(fp,song);
+}
+
+int addSongToPlaylist(FILE * fp, Song * song) {
 	if(playlist.length==playlist_max_length) {
 		myfprintf(fp,"%s playlist is at the max size\n",COMMAND_RESPOND_ERROR);
 		return -1;
@@ -592,6 +597,7 @@ int deleteFromPlaylist(FILE * fp, int song) {
 		/*if(playlist.current>=playlist.length) return playerStop(fp);
 		else return playPlaylistOrderNumber(fp,playlist.current);*/
 		playerStop(stderr);
+		playlist_noGoToNext = 1;
 	}
 	else if(playlist_state!=PLAYLIST_STATE_STOP && 
 			playlist.current>songOrder) {
@@ -632,6 +638,7 @@ int stopPlaylist(FILE * fp) {
 	playerCloseAudio();
 	playlist.queued = -1;
 	playlist_state = PLAYLIST_STATE_STOP;
+	playlist_noGoToNext = 0;
 	/*stats.playTime+=getPlayerElapsedTime();*/
 	if(playlist.random) randomizeOrder(0,playlist.length-1);
 	return 0;
@@ -643,6 +650,7 @@ int playPlaylistOrderNumber(FILE * fp, int orderNum) {
 	if(playerStop(fp)<0) return -1;
 
 	playlist_state = PLAYLIST_STATE_PLAY;
+	playlist_noGoToNext = 0;
 	playlist.queued = -1;
 	playlist_queueError = 0;
 	playlist.current = orderNum;
@@ -700,25 +708,6 @@ int playPlaylist(FILE * fp, int song, int stopOnError) {
 	return playPlaylistOrderNumber(fp,i);
 }
 
-void playPlaylistIfPlayerStopped() {
-	if(getPlayerState()==PLAYER_STATE_STOP) {
-		int error = getPlayerError();
-
-		if(error==PLAYER_ERROR_NOERROR) playlist_errorCount = 0;
-		else playlist_errorCount++;
-
-		if(playlist_state==PLAYLIST_STATE_PLAY && (
-				(playlist_stopOnError && 
-				error!=PLAYER_ERROR_NOERROR) ||
-				error==PLAYER_ERROR_AUDIO ||
-				error==PLAYER_ERROR_SYSTEM ||
-				playlist_errorCount>=playlist.length)) {
-			stopPlaylist(stderr);
-		}
-		else nextSongInPlaylist(stderr);
-	}
-}
-
 void syncPlayerAndPlaylist() {
 	if(playlist_state!=PLAYLIST_STATE_PLAY) return;
 
@@ -726,6 +715,19 @@ void syncPlayerAndPlaylist() {
 	else syncPlaylistWithQueue(!playlist_queueError);
 }
 
+int currentSongInPlaylist(FILE * fp) {
+	if(playlist_state!=PLAYLIST_STATE_PLAY) return 0;
+
+	playlist_stopOnError = 0;
+
+	if(playlist.current<playlist.length) {
+		return playPlaylistOrderNumber(fp,playlist.current);
+	}
+	else return stopPlaylist(fp);;
+
+	return 0;
+}
+
 int nextSongInPlaylist(FILE * fp) {
 	if(playlist_state!=PLAYLIST_STATE_PLAY) return 0;
 
@@ -747,6 +749,26 @@ int nextSongInPlaylist(FILE * fp) {
 	return 0;
 }
 
+void playPlaylistIfPlayerStopped() {
+	if(getPlayerState()==PLAYER_STATE_STOP) {
+		int error = getPlayerError();
+
+		if(error==PLAYER_ERROR_NOERROR) playlist_errorCount = 0;
+		else playlist_errorCount++;
+
+		if(playlist_state==PLAYLIST_STATE_PLAY && (
+				(playlist_stopOnError && 
+				error!=PLAYER_ERROR_NOERROR) ||
+				error==PLAYER_ERROR_AUDIO ||
+				error==PLAYER_ERROR_SYSTEM ||
+				playlist_errorCount>=playlist.length)) {
+			stopPlaylist(stderr);
+		}
+		else if(playlist_noGoToNext) currentSongInPlaylist(stderr);
+		else nextSongInPlaylist(stderr);
+	}
+}
+
 int getPlaylistRepeatStatus() {
 	return playlist.repeat;
 }
@@ -977,7 +999,6 @@ int shufflePlaylist(FILE * fp) {
 }
 
 int deletePlaylist(FILE * fp, char * file) {
-	struct stat st;
 	char * rfile = malloc(strlen(file)+strlen(".")+
 			strlen(PLAYLIST_FILE_SUFFIX)+1);
 	char * actualFile;
@@ -994,17 +1015,7 @@ int deletePlaylist(FILE * fp, char * file) {
 		return -1;
 	}
 
-	if(stat(file,&st)<0) {
-		myfprintf(fp,"%s problems stat'ing\n",COMMAND_RESPOND_ERROR);
-		return -1;
-	}
-
-	if(!S_ISREG(st.st_mode)) {
-		myfprintf(fp,"%s not a file\n",COMMAND_RESPOND_ERROR);
-		return -1;
-	}
-
-	if(unlink(file)<0) {
+	if(unlink(actualFile)<0) {
 		myfprintf(fp,"%s problems deleting file\n",COMMAND_RESPOND_ERROR);
 		return -1;
 	}
@@ -1132,7 +1143,7 @@ int loadPlaylist(FILE * fp, char * file) {
 	while(fclose(fileP) && errno==EINTR);
 
 	if(erroredFile) {
-		fprintf(fp,"%s can't add file \"%s\"\n",COMMAND_RESPOND_ERROR,
+		myfprintf(fp,"%s can't add file \"%s\"\n",COMMAND_RESPOND_ERROR,
 				erroredFile);
 		free(erroredFile);
 		return -1;
diff --git a/src/playlist.h b/src/playlist.h
index a5036e304..2e3d85e79 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -41,6 +41,8 @@ int clearPlaylist(FILE * fp);
 
 int addToPlaylist(FILE * fp, char * file);
 
+int addSongToPlaylist(FILE * fp, Song * song);
+
 int showPlaylist(FILE * fp);
 
 int deleteFromPlaylist(FILE * fp, int song);
diff --git a/src/song.c b/src/song.c
index 9158da0a4..13c5ec1c1 100644
--- a/src/song.c
+++ b/src/song.c
@@ -30,6 +30,7 @@
 #define SONG_ALBUM	"Album: "
 #define SONG_TRACK	"Track: "
 #define SONG_TITLE	"Title: "
+#define SONG_TIME	"Time: "
 #define SONG_MTIME	"mtime: "
 
 #include <stdlib.h>
@@ -43,25 +44,28 @@ Song * newSong(char * file) {
 	song->file = strdup(file);
 #ifdef HAVE_OGG
 	if((song->mtime = isOgg(file))) {
-		song->tag = oggCommentDup(file);
+		song->tag = oggTagDup(file);
 		return song;
 	}
 #endif
 #ifdef HAVE_FLAC
 	if((song->mtime = isFlac(file))) {
-		if(!(song->tag = flacVorbisCommentDup(file))) {
-			song->tag = id3Dup(file);
-		}
+		song->tag = flacTagDup(file);
 		return song;
 	}
 #endif
 #ifdef HAVE_MAD
 	if((song->mtime = isMp3(file))) {
-		song->tag = id3Dup(file);
+		song->tag = mp3TagDup(file);
+		return song;
+	}
+#endif
+#ifdef HAVE_AUDIOFILE
+	if((song->mtime = isWave(file))) {
+		song->tag = audiofileTagDup(file);
 		return song;
 	}
 #endif
-
 	return song;
 }
 
@@ -169,6 +173,10 @@ void readSongInfoIntoList(FILE * fp, SongList * list) {
 			if(!song->tag) song->tag = newMpdTag();
 			song->tag->title = strdup(&(buffer[strlen(SONG_TITLE)]));
 		}
+		else if(0==strncmp(SONG_TIME,buffer,strlen(SONG_TIME))) {
+			if(!song->tag) song->tag = newMpdTag();
+			song->tag->time = atoi(&(buffer[strlen(SONG_TIME)]));
+		}
 		else if(0==strncmp(SONG_MTIME,buffer,strlen(SONG_MTIME))) {
 			song->mtime = atoi(&(buffer[strlen(SONG_TITLE)]));
 		}
@@ -189,21 +197,25 @@ int updateSongInfo(Song * song) {
 	if(song->tag) freeMpdTag(song->tag);
 #ifdef HAVE_MAD
 	if((song->mtime = isMp3(song->file))) {
-		song->tag = id3Dup(song->file);
+		song->tag = mp3TagDup(song->file);
 		return 0;
 	}
 #endif
 #ifdef HAVE_OGG
 	if((song->mtime = isOgg(song->file))) {
-		song->tag = oggCommentDup(song->file);
+		song->tag = oggTagDup(song->file);
 		return 0;
 	}
 #endif
 #ifdef HAVE_FLAC
 	if((song->mtime = isFlac(song->file))) {
-		if(!(song->tag = flacVorbisCommentDup(song->file))) {
-			song->tag = id3Dup(song->file);
-		}
+		song->tag = flacTagDup(song->file);
+		return 0;
+	}
+#endif
+#ifdef HAVE_AUDIOFILE
+	if((song->mtime = isWave(song->file))) {
+		song->tag = audiofileTagDup(song->file);
 		return 0;
 	}
 #endif
diff --git a/src/tables.c b/src/tables.c
index 358e54e89..0435aab5f 100644
--- a/src/tables.c
+++ b/src/tables.c
@@ -68,7 +68,7 @@ void closeTables() {
 void addSongToSomeAlbumTable(List * table, Song * song) {
 	void * album;
 	if(!song->tag) return;
-	if(!song->tag->title || !strlen(song->tag->title)) return;
+	if(!song->tag->album || !strlen(song->tag->album)) return;
 	if(findInList(table,song->tag->album,&album)) {
 		insertInList((SongList *)album,song->file,song);
 	}
diff --git a/src/tag.c b/src/tag.c
index 530997c54..3eb909c88 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -20,6 +20,9 @@
 #include "path.h"
 #include "myfprintf.h"
 #include "sig_handlers.h"
+#include "mp3_decode.h"
+#include "audiofile_decode.h"
+#include "char_conv.h"
 
 #include <sys/stat.h>
 #include <stdlib.h>
@@ -47,6 +50,7 @@ void printMpdTag(FILE * fp, MpdTag * tag) {
 	if(tag->album) myfprintf(fp,"Album: %s\n",tag->album);
 	if(tag->track) myfprintf(fp,"Track: %s\n",tag->track);
 	if(tag->title) myfprintf(fp,"Title: %s\n",tag->title);
+	if(tag->time>=0) myfprintf(fp,"Time: %i\n",tag->time);
 }
 
 #ifdef HAVE_ID3TAG
@@ -121,19 +125,45 @@ MpdTag * id3Dup(char * filename) {
 
 	id3_file_close(file);
 
-	if(ret) {
-		if(!ret->artist) ret->artist = strdup("");
-		if(!ret->album) ret->album = strdup("");
-		if(!ret->title) ret->title = strdup("");
-		if(!ret->track) ret->track = strdup("");
-	}
 	unblockSignals();
 #endif
 	return ret;	
 }
 
+#ifdef HAVE_AUDIOFILE
+MpdTag * audiofileTagDup(char * file) {
+	MpdTag * ret = NULL;
+	int time = getAudiofileTotalTime(rmp2amp(file));
+	
+	if (time>=0) {
+		if(!ret) ret = newMpdTag();
+		ret->time = time;
+	}
+
+	return ret;
+}
+#endif
+
+#ifdef HAVE_MAD
+MpdTag * mp3TagDup(char * file) {
+	MpdTag * ret = NULL;
+	int time;
+
+	ret = id3Dup(file);
+
+	time = getMp3TotalTime(rmp2amp(file));
+
+	if(time>=0) {
+		if(!ret) ret = newMpdTag();
+		ret->time = time;
+	}
+
+	return ret;
+}
+#endif
+
 #ifdef HAVE_OGG
-MpdTag * oggCommentDup(char * file) {
+MpdTag * oggTagDup(char * file) {
 	MpdTag * ret = NULL;
 	FILE * fp;
 	OggVorbis_File vf;
@@ -142,6 +172,8 @@ MpdTag * oggCommentDup(char * file) {
 	char * s1;
 	char * s2;
 
+	setCharSetConversion("LATIN1","UTF-8");
+
 	while(!(fp = fopen(rmp2amp(file),"r")) && errno==EINTR);
 	if(!fp) return NULL;
 	blockSignals();
@@ -151,6 +183,9 @@ MpdTag * oggCommentDup(char * file) {
 		return NULL;
 	}
 
+	ret = newMpdTag();
+	ret->time = (int)(ov_time_total(&vf,-1)+0.5);
+
 	comments = ov_comment(&vf,-1)->user_comments;
 
 	while(*comments) {
@@ -158,20 +193,32 @@ MpdTag * oggCommentDup(char * file) {
 		s1 = strtok(temp,"=");
 		s2 = strtok(NULL,"=");
 		if(0==strcasecmp(s1,"artist")) {
-			if(!ret) ret = newMpdTag();
-			if(!ret->artist && s2) ret->artist = strdup(s2);
+			if(!ret->artist && s2) {
+				if(!(ret->artist = convStrDup(s2))) {
+					ret->artist = strdup(s2);
+				}
+			}
 		}
 		else if(0==strcasecmp(s1,"title")) {
-			if(!ret) ret = newMpdTag();
-			if(!ret->title && s2) ret->title = strdup(s2);
+			if(!ret->title && s2) {
+				if(!(ret->title = convStrDup(s2))) {
+					ret->title = strdup(s2);
+				}
+			}
 		}
 		else if(0==strcasecmp(s1,"album")) {
-			if(!ret) ret = newMpdTag();
-			if(!ret->album && s2) ret->album = strdup(s2);
+			if(!ret->album && s2) {
+				if(!(ret->album = convStrDup(s2))) {
+					ret->album = strdup(s2);
+				}
+			}
 		}
 		else if(0==strcasecmp(s1,"tracknumber")) {
-			if(!ret) ret = newMpdTag();
-			if(!ret->track && s2) ret->track = strdup(s2);
+			if(!ret->track && s2) {
+				if(!(ret->track = convStrDup(s2))) {
+					ret->track = strdup(s2);
+				}
+			}
 		}
 		free(temp);
 		++comments;
@@ -179,27 +226,21 @@ MpdTag * oggCommentDup(char * file) {
 
 	ov_clear(&vf);
 
-	if(ret) {
-		if(!ret->artist) ret->artist = strdup("");
-		if(!ret->album) ret->album = strdup("");
-		if(!ret->title) ret->title = strdup("");
-		if(!ret->track) ret->track = strdup("");
-	}
-
 	unblockSignals();
 	return ret;	
 }
 #endif
 
 #ifdef HAVE_FLAC
-MpdTag * flacVorbisCommentDup(char * file) {
+MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) {
 	MpdTag * ret = NULL;
 	FLAC__Metadata_SimpleIterator * it;
 	FLAC__StreamMetadata * block = NULL;
-	int found = 0;
 	int offset;
 	int len, pos;
 
+	*vorbisCommentFound = 0;
+
 	blockSignals();
 	it = FLAC__metadata_simple_iterator_new();
 	if(!FLAC__metadata_simple_iterator_init(it,rmp2amp(file),1,0)) {
@@ -209,69 +250,110 @@ MpdTag * flacVorbisCommentDup(char * file) {
 	}
 	
 	do {
-		if(block) FLAC__metadata_object_delete(block);
 		block = FLAC__metadata_simple_iterator_get_block(it);
-		if(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) found=1;
-	} while(!found && FLAC__metadata_simple_iterator_next(it));
-
-	if(found) {
-		offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"artist");
-		if(offset>=0) {
-			if(!ret) ret = newMpdTag();
-			pos = strlen("artist=");
-			len = block->data.vorbis_comment.comments[offset].length-pos;
-			if(len>0) {
-				ret->artist = malloc(len+1);
-				memcpy(ret->artist,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
-				ret->artist[len] = '\0';
+		if(!block) break;
+		if(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) {
+			char * dup;
+
+			setCharSetConversion("LATIN1","UTF-8");
+
+			offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"artist");
+			if(offset>=0) {
+				*vorbisCommentFound = 1;
+				if(!ret) ret = newMpdTag();
+				pos = strlen("artist=");
+				len = block->data.vorbis_comment.comments[offset].length-pos;
+				if(len>0) {
+					dup = malloc(len+1);
+					memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
+					dup[len] = '\0';
+					if((ret->artist = convStrDup(dup))) {
+						free(dup);
+					}
+					else ret->artist = dup;
+				}
 			}
-		}
-		offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"album");
-		if(offset>=0) {
-			if(!ret) ret = newMpdTag();
-			pos = strlen("album=");
-			len = block->data.vorbis_comment.comments[offset].length-pos;
-			if(len>0) {
-				ret->album = malloc(len+1);
-				memcpy(ret->album,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
-				ret->album[len] = '\0';
+			offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"album");
+			if(offset>=0) {
+				*vorbisCommentFound = 1;
+				if(!ret) ret = newMpdTag();
+				pos = strlen("album=");
+				len = block->data.vorbis_comment.comments[offset].length-pos;
+				if(len>0) {
+					dup = malloc(len+1);
+					memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
+					dup[len] = '\0';
+					if((ret->album = convStrDup(dup))) {
+						free(dup);
+					}
+					else ret->album = dup;
+				}
 			}
-		}
-		offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"title");
-		if(offset>=0) {
-			if(!ret) ret = newMpdTag();
-			pos = strlen("title=");
-			len = block->data.vorbis_comment.comments[offset].length-pos;
-			if(len>0) {
-				ret->title = malloc(len+1);
-				memcpy(ret->title,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
-				ret->title[len] = '\0';
+			offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"title");
+			if(offset>=0) {
+				*vorbisCommentFound = 1;
+				if(!ret) ret = newMpdTag();
+				pos = strlen("title=");
+				len = block->data.vorbis_comment.comments[offset].length-pos;
+				if(len>0) {
+					dup = malloc(len+1);
+					memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
+					dup[len] = '\0';
+					if((ret->title = convStrDup(dup))) {
+						free(dup);
+					}
+					else ret->title = dup;
+				}
 			}
-		}
-		offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"tracknumber");
-		if(offset>=0) {
-			if(!ret) ret = newMpdTag();
-			pos = strlen("tracknumber=");
-			len = block->data.vorbis_comment.comments[offset].length-pos;
-			if(len>0) {
-				ret->track = malloc(len+1);
-				memcpy(ret->track,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
-				ret->track[len] = '\0';
+			offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block,0,"tracknumber");
+			if(offset>=0) {
+				*vorbisCommentFound = 1;
+				if(!ret) ret = newMpdTag();
+				pos = strlen("tracknumber=");
+				len = block->data.vorbis_comment.comments[offset].length-pos;
+				if(len>0) {
+					dup = malloc(len+1);
+					memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len);
+					dup[len] = '\0';
+					if((ret->track = convStrDup(dup))) {
+						free(dup);
+					}
+					else ret->track = dup;
+				}
 			}
 		}
-		if(ret) {
-			if(!ret->artist) ret->artist = strdup("");
-			if(!ret->album) ret->album = strdup("");
-			if(!ret->title) ret->title = strdup("");
-			if(!ret->track) ret->track = strdup("");
+		else if(block->type == FLAC__METADATA_TYPE_STREAMINFO) {
+			if(!ret) ret = newMpdTag();
+			ret->time = ((float)block->data.stream_info.
+					total_samples) /
+					block->data.stream_info.sample_rate +
+					0.5;
 		}
-	}
+		FLAC__metadata_object_delete(block);
+	} while(FLAC__metadata_simple_iterator_next(it));
 
-	if(block) FLAC__metadata_object_delete(block);
 	FLAC__metadata_simple_iterator_delete(it);
 	unblockSignals();
 	return ret;
 }
+
+MpdTag * flacTagDup(char * file) {
+	MpdTag * ret = NULL;
+	int foundVorbisComment = 0;
+
+	ret = flacMetadataDup(file,&foundVorbisComment);
+	if(!ret) return NULL;
+	if(!foundVorbisComment) {
+		MpdTag * temp = id3Dup(file);
+		if(temp) {
+			temp->time = ret->time;
+			freeMpdTag(ret);
+			ret = temp;
+		}
+	}
+
+	return ret;
+}
 #endif
 
 MpdTag * newMpdTag() {
@@ -280,6 +362,7 @@ MpdTag * newMpdTag() {
 	ret->artist = NULL;
 	ret->title = NULL;
 	ret->track = NULL;
+	ret->time = -1;
 	return ret;
 }
 
@@ -300,6 +383,7 @@ MpdTag * mpdTagDup(MpdTag * tag) {
 		ret->album = strdup(tag->album);
 		ret->title = strdup(tag->title);
 		ret->track = strdup(tag->track);
+		ret->time = tag->time;
 	}
 
 	return ret;
diff --git a/src/tag.h b/src/tag.h
index 0cfa5e019..50c52757e 100644
--- a/src/tag.h
+++ b/src/tag.h
@@ -26,17 +26,28 @@ typedef struct _MpdTag {
 	char * album;
 	char * track;
 	char * title;
+	int time;
 } MpdTag;
 
 MpdTag * newMpdTag();
 
 void freeMpdTag(MpdTag * tag);
 
-MpdTag * id3Dup(char * file);
+#ifdef HAVE_MAD
+MpdTag * mp3TagDup(char * file);
+#endif
 
-MpdTag * oggCommentDup(char * file);
+#ifdef HAVE_OGG
+MpdTag * oggTagDup(char * file);
+#endif
 
-MpdTag * flacVorbisCommentDup(char * file);
+#ifdef HAVE_FLAC
+MpdTag * flacTagDup(char * file);
+#endif
+
+#ifdef HAVE_AUDIOFILE
+MpdTag * audiofileTagDup(char * file);
+#endif
 
 void printMpdTag(FILE * fp, MpdTag * tag);
 
-- 
2.24.1