Hi Max,

This patch simply prints the available protocols when --version is executed.

git://git.musicpd.org/avuton/mpd.git

Avuton Olrich (1):
      cmdline: Print available protocols when --version is run.

 NEWS          |    1 +
 src/cmdline.c |    5 +++++
 src/ls.c      |   20 ++++++++++++++++++++
 src/ls.h      |    6 ++++++
 4 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index 84b5e6a..4df9486 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,7 @@ ver 0.15 - (200?/??/??)
 * daemon: ignore "user" setting if already running as that user
 * listen: fix broken client IP addresses in log
 * 32 bit audio support
+* Print available protocols in --version


 ver 0.14.2 (2009/02/13)
diff --git a/src/cmdline.c b/src/cmdline.c
index b0cdbfb..e37cea7 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 c6987ae..679017e 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:// ", *prefixes);
+#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 d6e4c98..f86845e 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
-- 
avuton
--
|  (\_/)  This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to