aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 14:02:40 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 14:02:40 +0200
commit438b56f0bab3e814185d2f3fa2f03df82829302a (patch)
tree9904210c41bb2357baeefa7c440f25ce21612b47
parent4665f2bf32c59f263d22c2315d60509c9ae8854b (diff)
ls: don't pass "fd" to lsPlaylists(), printRemoteUrlHandlers()
Pass the client struct instead of the raw file descriptor.
-rw-r--r--src/command.c4
-rw-r--r--src/ls.c12
-rw-r--r--src/ls.h6
3 files changed, 12 insertions, 10 deletions
diff --git a/src/command.c b/src/command.c
index 44f56128..1502477a 100644
--- a/src/command.c
+++ b/src/command.c
@@ -300,7 +300,7 @@ static void addCommand(const char *name,
static int handleUrlHandlers(struct client *client, mpd_unused int *permission,
mpd_unused int argc, mpd_unused char *argv[])
{
- return printRemoteUrlHandlers(client_get_fd(client));
+ return printRemoteUrlHandlers(client);
}
static int handleTagTypes(struct client *client, mpd_unused int *permission,
@@ -601,7 +601,7 @@ static int handleLsInfo(struct client *client, mpd_unused int *permission,
}
if (isRootDirectory(path))
- return lsPlaylists(client_get_fd(client), path);
+ return lsPlaylists(client, path);
return 0;
}
diff --git a/src/ls.c b/src/ls.c
index 4a49e240..f5c48a6f 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -19,7 +19,7 @@
#include "ls.h"
#include "playlist.h"
#include "path.h"
-#include "myfprintf.h"
+#include "client.h"
#include "log.h"
#include "utf8.h"
#include "utils.h"
@@ -30,12 +30,12 @@ static const char *remoteUrlPrefixes[] = {
NULL
};
-int printRemoteUrlHandlers(int fd)
+int printRemoteUrlHandlers(struct client *client)
{
const char **prefixes = remoteUrlPrefixes;
while (*prefixes) {
- fdprintf(fd, "handler: %s\n", *prefixes);
+ client_printf(client, "handler: %s\n", *prefixes);
prefixes++;
}
@@ -98,7 +98,7 @@ int isRemoteUrl(const char *url)
return 0;
}
-int lsPlaylists(int fd, const char *utf8path)
+int lsPlaylists(struct client *client, const char *utf8path)
{
DIR *dir;
struct stat st;
@@ -168,8 +168,8 @@ int lsPlaylists(int fd, const char *utf8path)
node = list->firstNode;
while (node != NULL) {
if (!strchr(node->key, '\n')) {
- fdprintf(fd, "playlist: %s%s\n", duplicated,
- node->key);
+ client_printf(client, "playlist: %s%s\n",
+ duplicated, node->key);
}
node = node->nextNode;
}
diff --git a/src/ls.h b/src/ls.h
index af414e88..bba11ff0 100644
--- a/src/ls.h
+++ b/src/ls.h
@@ -21,7 +21,9 @@
#include "decoder_list.h"
-int lsPlaylists(int fd, const char *utf8path);
+struct client;
+
+int lsPlaylists(struct client *client, const char *utf8path);
const char *getSuffix(const char *utf8file);
@@ -40,7 +42,7 @@ struct decoder_plugin *hasMusicSuffix(const char *utf8file, unsigned int next);
struct decoder_plugin *isMusic(const char *utf8file, time_t * mtime,
unsigned int next);
-int printRemoteUrlHandlers(int fd);
+int printRemoteUrlHandlers(struct client *client);
int isFile(const char *utf8file, time_t * mtime);