]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - play.c
play: Convert com_jmp() to lopsub.
[paraslash.git] / play.c
diff --git a/play.c b/play.c
index e0ff240514fd1a575ac762acbb965cf9bdf0add9..952707545813c5af3613b3742603b5c78317682b 100644 (file)
--- a/play.c
+++ b/play.c
@@ -947,22 +947,28 @@ static int com_fg(struct play_task *pt,
 }
 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)
+static int com_jmp(struct play_task *pt, struct lls_parse_result *lpr)
 {
        int32_t percent;
        int ret;
+       char *errctx;
 
-       if (argc != 2)
-               return -E_PLAY_SYNTAX;
-       ret = para_atoi32(argv[1], &percent);
+       ret = lls(lls_check_arg_count(lpr, 1, 1, &errctx));
+       if (ret < 0) {
+               if (errctx)
+                       PARA_ERROR_LOG("%s\n", errctx);
+               free(errctx);
+               return ret;
+       }
+       ret = para_atoi32(lls_input(0, lpr), &percent);
        if (ret < 0)
                return ret;
        if (percent < 0 || percent > 100)
@@ -978,6 +984,7 @@ static int com_jmp(struct play_task *pt, int argc, char **argv)
        kill_stream(pt);
        return 0;
 }
+EXPORT_PLAY_CMD_HANDLER(jmp);
 
 static int com_ff(struct play_task *pt, int argc, char **argv)
 {