Commit 68232176 authored by Max Kellermann's avatar Max Kellermann

ls: moved generic URI utilities to uri.c

"ls" is a bad name for a library which parses URIs. We'll move the rest of the "ls" library later.
parent 7957fefc
......@@ -143,6 +143,7 @@ mpd_headers = \
src/tag_print.h \
src/tag_save.h \
src/strset.h \
src/uri.h \
src/utils.h \
src/volume.h \
src/zeroconf.h src/zeroconf-internal.h \
......@@ -236,6 +237,7 @@ src_mpd_SOURCES = \
src/tag_print.c \
src/tag_save.c \
src/strset.c \
src/uri.c \
src/utils.c \
src/volume.c \
src/locate.c \
......
......@@ -23,6 +23,7 @@
#include "playlist_save.h"
#include "queue_print.h"
#include "ls.h"
#include "uri.h"
#include "directory.h"
#include "directory_print.h"
#include "database.h"
......
......@@ -20,7 +20,7 @@
#include "_ogg_common.h"
#include "config.h"
#include "ls.h"
#include "uri.h"
#ifndef HAVE_TREMOR
#include <vorbis/vorbisfile.h>
......
......@@ -30,7 +30,7 @@
#include "mapper.h"
#include "path.h"
#include "log.h"
#include "ls.h"
#include "uri.h"
#include <glib.h>
......
......@@ -17,6 +17,7 @@
*/
#include "ls.h"
#include "uri.h"
#include "client.h"
#include "config.h"
......@@ -46,11 +47,6 @@ void print_supported_uri_schemes(struct client *client)
}
}
bool uri_has_scheme(const char *uri)
{
return strstr(uri, "://") != NULL;
}
bool uri_supported_scheme(const char *uri)
{
const char **urlPrefixes = remoteUrlPrefixes;
......@@ -65,11 +61,3 @@ bool uri_supported_scheme(const char *uri)
return false;
}
/* suffixes should be ascii only characters */
const char *uri_get_suffix(const char *utf8file)
{
const char *dot = strrchr(g_basename(utf8file), '.');
return dot != NULL ? dot + 1 : NULL;
}
......@@ -24,12 +24,6 @@
struct client;
/**
* Checks whether the specified URI has a schema in the form
* "scheme://".
*/
bool uri_has_scheme(const char *uri);
/**
* Checks whether the scheme of the specified URI is supported by MPD.
* It is not allowed to pass an URI without a scheme, check with
* uri_has_scheme() first.
......@@ -42,6 +36,4 @@ bool uri_supported_scheme(const char *url);
*/
void print_supported_uri_schemes(struct client *client);
const char *uri_get_suffix(const char *utf8file);
#endif
......@@ -25,7 +25,7 @@
#include "playlist_internal.h"
#include "player_control.h"
#include "database.h"
#include "ls.h"
#include "uri.h"
#include "song.h"
#include "idle.h"
......
......@@ -21,7 +21,7 @@
#include "song.h"
#include "mapper.h"
#include "path.h"
#include "ls.h"
#include "uri.h"
#include "database.h"
#include "idle.h"
......
......@@ -19,7 +19,7 @@
#include "queue_save.h"
#include "queue.h"
#include "song.h"
#include "ls.h"
#include "uri.h"
#include "database.h"
#include <stdlib.h>
......
......@@ -17,7 +17,7 @@
*/
#include "song.h"
#include "ls.h"
#include "uri.h"
#include "directory.h"
#include "mapper.h"
#include "decoder_list.h"
......
......@@ -21,7 +21,7 @@
#include "song.h"
#include "mapper.h"
#include "path.h"
#include "ls.h"
#include "uri.h"
#include "database.h"
#include "idle.h"
#include "conf.h"
......
......@@ -21,7 +21,7 @@
#include "database.h"
#include "directory.h"
#include "song.h"
#include "ls.h"
#include "uri.h"
#include "mapper.h"
#include "path.h"
#include "decoder_list.h"
......
/*
* Copyright (C) 2003-2009 The Music Player Daemon Project
* 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 "uri.h"
#include <glib.h>
#include <string.h>
bool uri_has_scheme(const char *uri)
{
return strstr(uri, "://") != NULL;
}
/* suffixes should be ascii only characters */
const char *
uri_get_suffix(const char *uri)
{
const char *dot = strrchr(g_basename(uri), '.');
return dot != NULL ? dot + 1 : NULL;
}
/*
* Copyright (C) 2003-2009 The Music Player Daemon Project
* 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 MPD_URI_H
#define MPD_URI_H
#include <stdbool.h>
/**
* Checks whether the specified URI has a schema in the form
* "scheme://".
*/
bool uri_has_scheme(const char *uri);
const char *
uri_get_suffix(const char *uri);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment