play: Convert com_quit() to lopsub.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 28 Mar 2016 03:52:25 +0000 (03:52 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 26 Mar 2017 09:02:28 +0000 (11:02 +0200)
This converts the last subcommand of para_play. Cleanups are done in
subsequent patches although the declarations of the command handlers
are removed here because they have become unused and triggered
compiler warnings.

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

diff --git a/error.h b/error.h
index a4038d5..a4d79ab 100644 (file)
--- a/error.h
+++ b/error.h
        PARA_ERROR(PERM, "permission denied"), \
        PARA_ERROR(PLAYLIST_EMPTY, "attempted to load empty playlist"), \
        PARA_ERROR(PLAYLIST_LOADED, ""), /* not really an error */ \
-       PARA_ERROR(PLAY_SYNTAX, "para_play: syntax error"), \
        PARA_ERROR(PREBUFFER_SUCCESS, "prebuffering complete"), \
        PARA_ERROR(PRIVATE_KEY, "can not read private key"), \
        PARA_ERROR(PUBLIC_KEY, "can not read public key"), \
index 1f54f2a..195b47b 100644 (file)
@@ -83,3 +83,10 @@ caption = list of commands
        [description]
                Mainly useful for debugging.
        [/description]
+
+[subcommand quit]
+       purpose = exit para_play
+       [description]
+               Pressing CTRL+D causes EOF on stdin which also exits
+               para_play.
+       [/description]
diff --git a/play.c b/play.c
index e608c6c..c6a7859 100644 (file)
--- a/play.c
+++ b/play.c
@@ -668,7 +668,6 @@ static char **get_mapped_keyseqs(void)
 #include "play.command_list.h"
 
 typedef int play_command_handler_t(struct play_task *, int, char**);
-static play_command_handler_t PLAY_COMMAND_HANDLERS;
 
 /* defines one command of para_play */
 struct pp_command {
@@ -727,13 +726,13 @@ static void detach_stdout(struct play_task *pt)
        btr_remove_node(&pt->btrn);
 }
 
-static int com_quit(struct play_task *pt, int argc, __a_unused char **argv)
+static int com_quit(struct play_task *pt,
+               __a_unused struct lls_parse_result *lpr)
 {
-       if (argc != 1)
-               return -E_PLAY_SYNTAX;
        pt->rq = CRT_TERM_RQ;
        return 0;
 }
+EXPORT_PLAY_CMD_HANDLER(quit);
 
 static int com_help(struct play_task *pt, struct lls_parse_result *lpr)
 {
index c0e8d7f..8cdc9b0 100644 (file)
--- a/play.cmd
+++ b/play.cmd
@@ -1,8 +1,3 @@
 BN: play
 SF: play.c
 SN: list of commands
----
-N: quit
-D: Exit para_play.
-U: quit
-H: Pressing CTRL+D causes EOF on stdin which also exits para_play.