]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
play: Convert com_next() to lopsub.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 28 Mar 2016 04:05:14 +0000 (04:05 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Mar 2017 09:02:28 +0000 (11:02 +0200)
com_next() is also called from com_jmp(), where we needed to pass
a fake argv. This is no longer necessary as com_next() now takes
a parse result pointer which is unused. So we may just pass NULL
from com_jmp().

m4/lls/play_cmd.suite.m4
play.c
play.cmd

index d0e50261d3f5fcfe191f2a47b689adf0a3cfa298..e62bb0000d736a87ff4bf2513e3ae53593716be3 100644 (file)
@@ -20,3 +20,5 @@ caption = list of commands
                In this mode, file name and play time of the current audio file are
                displayed. Hit CTRL+C or : to switch to input mode.
        [/description]
+[subcommand next]
+       purpose = load the next file of the playlist
diff --git a/play.c b/play.c
index 996734f4b3138fe71bc3c5c4fd42e8ce4f766849..ce10a56bb9001f6675c18d06ce60323bbfeccf7e 100644 (file)
--- a/play.c
+++ b/play.c
@@ -924,12 +924,11 @@ static int com_prev(struct play_task *pt, int argc, __a_unused char **argv)
        return 0;
 }
 
-static int com_next(struct play_task *pt, int argc, __a_unused char **argv)
+static int com_next(struct play_task *pt,
+               __a_unused struct lls_parse_result *lpr)
 {
        int ret;
 
-       if (argc != 1)
-               return -E_PLAY_SYNTAX;
        ret = next_valid_file(pt);
        if (ret < 0)
                return ret;
@@ -939,6 +938,7 @@ static int com_next(struct play_task *pt, int argc, __a_unused char **argv)
        pt->start_chunk = 0;
        return 0;
 }
+EXPORT_PLAY_CMD_HANDLER(next);
 
 static int com_fg(struct play_task *pt,
                __a_unused struct lls_parse_result *lpr)
@@ -969,7 +969,7 @@ static int com_jmp(struct play_task *pt, int argc, char **argv)
        if (percent < 0 || percent > 100)
                return -ERRNO_TO_PARA_ERROR(EINVAL);
        if (percent == 100)
-               return com_next(pt, 1, (char *[]){"next", NULL});
+               return com_next(pt, NULL);
        if (pt->playing && !pt->fn.btrn)
                return 0;
        pt->start_chunk = percent * pt->num_chunks / 100;
index ec5373b60d8d80d0d162a274a73af5f607e58610..5e090b705c016ee85e4313822aa6c230b26a5ece 100644 (file)
--- a/play.cmd
+++ b/play.cmd
@@ -2,11 +2,6 @@ BN: play
 SF: play.c
 SN: list of commands
 ---
-N: next
-D: Load next file.
-U: next
-H: Closes the current file and loads the next file of the playlist.
----
 N: prev
 D: Load previous file.
 U: prev