From ce9e297eb91a932a11f81890c800d0380b5bc9c9 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 28 Mar 2016 03:52:25 +0000 Subject: [PATCH] play: Convert com_quit() to lopsub. 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 | 1 - m4/lls/play_cmd.suite.m4 | 7 +++++++ play.c | 7 +++---- play.cmd | 5 ----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/error.h b/error.h index a4038d5c..a4d79aba 100644 --- a/error.h +++ b/error.h @@ -183,7 +183,6 @@ 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"), \ diff --git a/m4/lls/play_cmd.suite.m4 b/m4/lls/play_cmd.suite.m4 index 1f54f2af..195b47b9 100644 --- a/m4/lls/play_cmd.suite.m4 +++ b/m4/lls/play_cmd.suite.m4 @@ -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 e608c6cb..c6a78598 100644 --- 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) { diff --git a/play.cmd b/play.cmd index c0e8d7f1..8cdc9b08 100644 --- 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. -- 2.39.2