aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--doc/protocol.xml14
-rw-r--r--src/command.c5
3 files changed, 19 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 2b19b52b0..46a717f5d 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ ver 0.16 (20??/??/??)
- "addid" with negative position is deprecated
- "load" supports remote playlists (m3u, pls, xspf, lastfm://)
- allow changing replay gain mode on-the-fly
+ - omitting the range end is possible
* input:
- lastfm: obsolete plugin removed
* tags:
diff --git a/doc/protocol.xml b/doc/protocol.xml
index 3db128b18..eb48185e9 100644
--- a/doc/protocol.xml
+++ b/doc/protocol.xml
@@ -67,6 +67,20 @@
successful command executed in the command list.
</para>
</section>
+
+ <section>
+ <title>Ranges</title>
+
+ <para>
+ Some commands (e.g. <link
+ linkend="command_delete"><command>delete</command></link>)
+ allow specifying a range in the form
+ <parameter>START:END</parameter> (the <varname>END</varname>
+ item is not included in the range, similar to ranges in the
+ Python programming language). If <varname>END</varname> is
+ omitted, then the maximum possible value is assumed.
+ </para>
+ </section>
</chapter>
<chapter>
diff --git a/src/command.c b/src/command.c
index 2abdf47fa..38673f008 100644
--- a/src/command.c
+++ b/src/command.c
@@ -221,7 +221,7 @@ check_range(struct client *client, unsigned *value_r1, unsigned *value_r2,
if (*test == ':') {
value = strtol(++test, &test2, 10);
- if (*test2 != '\0' || test == test2) {
+ if (*test2 != '\0') {
va_list args;
va_start(args, fmt);
command_error_v(client, ACK_ERROR_ARG, fmt, args);
@@ -229,6 +229,9 @@ check_range(struct client *client, unsigned *value_r1, unsigned *value_r2,
return false;
}
+ if (test == test2)
+ value = G_MAXUINT;
+
if (value < 0) {
command_error(client, ACK_ERROR_ARG,
"Number is negative: %s", s);