aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAvuton Olrich <avuton@gmail.com>2009-03-03 08:01:42 -0800
committerMax Kellermann <max@duempel.org>2009-03-03 21:25:19 +0100
commite7f034dceff196b7588bca995a5e22bd480f71ca (patch)
tree47001ccd8bd98bc84925f8925b250458cb39b26a /src
parent0f64e658fd34923a3be815582be500b8248019a0 (diff)
downloadmpd-e7f034dceff196b7588bca995a5e22bd480f71ca.tar.gz
mpd-e7f034dceff196b7588bca995a5e22bd480f71ca.tar.xz
mpd-e7f034dceff196b7588bca995a5e22bd480f71ca.zip
cmdline: Print available protocols when --version is run.
Diffstat (limited to '')
-rw-r--r--src/cmdline.c5
-rw-r--r--src/ls.c20
-rw-r--r--src/ls.h6
3 files changed, 31 insertions, 0 deletions
diff --git a/src/cmdline.c b/src/cmdline.c
index b0cdbfb2f..e37cea737 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -23,6 +23,7 @@
#include "decoder_list.h"
#include "config.h"
#include "audioOutput.h"
+#include "ls.h"
#ifdef ENABLE_ARCHIVE
#include "archive_list.h"
@@ -63,6 +64,10 @@ static void version(void)
archive_plugin_print_all_suffixes(stdout);
#endif
+ puts("\n"
+ "Supported protocols:\n");
+ print_supported_uri_schemes_to_fp(stdout);
+
exit(EXIT_SUCCESS);
}
diff --git a/src/ls.c b/src/ls.c
index c6987aedb..92b8a213e 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -24,6 +24,12 @@
#include <assert.h>
#include <string.h>
+
+/**
+ * file:// is not included in remoteUrlPrefixes, the connection method
+ * is detected at runtime and displayed as a urlhandler if the client is
+ * connected by IPC socket.
+ */
static const char *remoteUrlPrefixes[] = {
#ifdef HAVE_CURL
"http://",
@@ -40,6 +46,20 @@ static const char *remoteUrlPrefixes[] = {
NULL
};
+void print_supported_uri_schemes_to_fp(FILE *fp)
+{
+ const char **prefixes = remoteUrlPrefixes;
+
+#ifdef HAVE_UN
+ fprintf(fp, "file:// ");
+#endif
+ while (*prefixes) {
+ fprintf(fp, "%s ", *prefixes);
+ prefixes++;
+ }
+ puts("\n");
+}
+
void print_supported_uri_schemes(struct client *client)
{
const char **prefixes = remoteUrlPrefixes;
diff --git a/src/ls.h b/src/ls.h
index d6e4c98b3..f86845e36 100644
--- a/src/ls.h
+++ b/src/ls.h
@@ -20,6 +20,7 @@
#define MPD_LS_H
#include <stdbool.h>
+#include <stdio.h>
struct client;
@@ -36,4 +37,9 @@ bool uri_supported_scheme(const char *url);
*/
void print_supported_uri_schemes(struct client *client);
+/**
+ * Send a list of supported URI schemes to a file pointer.
+ */
+void print_supported_uri_schemes_to_fp(FILE *fp);
+
#endif