]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - play.c
play: Convert com_bg() to lopsub.
[paraslash.git] / play.c
diff --git a/play.c b/play.c
index 6fe66678cc1cb2ef49681cf16355e55cc79b4d5c..2b43f3552a96c270b454a5b59e88f66061f9d98a 100644 (file)
--- a/play.c
+++ b/play.c
@@ -907,13 +907,11 @@ static int com_pause(struct play_task *pt, int argc, __a_unused char **argv)
        return 0;
 }
 
-static int com_prev(struct play_task *pt, int argc, __a_unused char **argv)
-
+static int com_prev(struct play_task *pt,
+       __a_unused struct lls_parse_result *lpr)
 {
        int ret;
 
-       if (argc != 1)
-               return -E_PLAY_SYNTAX;
        ret = previous_valid_file(pt);
        if (ret < 0)
                return ret;
@@ -923,13 +921,13 @@ static int com_prev(struct play_task *pt, int argc, __a_unused char **argv)
        pt->start_chunk = 0;
        return 0;
 }
+EXPORT_PLAY_CMD_HANDLER(prev);
 
-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,22 +937,23 @@ 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, int argc, __a_unused char **argv)
+static int com_fg(struct play_task *pt,
+               __a_unused struct lls_parse_result *lpr)
 {
-       if (argc != 1)
-               return -E_PLAY_SYNTAX;
        pt->background = false;
        return 0;
 }
+EXPORT_PLAY_CMD_HANDLER(fg);
 
-static int com_bg(struct play_task *pt, int argc, __a_unused char **argv)
+static int com_bg(struct play_task *pt,
+       __a_unused struct lls_parse_result *lpr)
 {
-       if (argc != 1)
-               return -E_PLAY_SYNTAX;
        pt->background = true;
        return 0;
 }
+EXPORT_PLAY_CMD_HANDLER(bg);
 
 static int com_jmp(struct play_task *pt, int argc, char **argv)
 {
@@ -969,7 +968,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;