From 534a94f441767947874cb15d18211edf758e9277 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 28 Mar 2016 03:47:55 +0000 Subject: [PATCH] play: Convert com_ls() to lopsub. This also gets rid of the undocumented pattern matching. The command now takes no arguments and always lists all files. --- m4/lls/play_cmd.suite.m4 | 7 +++++++ play.c | 21 ++++++--------------- play.cmd | 6 ------ 3 files changed, 13 insertions(+), 21 deletions(-) diff --git a/m4/lls/play_cmd.suite.m4 b/m4/lls/play_cmd.suite.m4 index 46646808..1c71e71e 100644 --- a/m4/lls/play_cmd.suite.m4 +++ b/m4/lls/play_cmd.suite.m4 @@ -47,3 +47,10 @@ caption = list of commands [description] Negative values mean to jump backwards the given amount of seconds. [/description] + +[subcommand ls] + purpose = list the playlist + [description] + This prints all paths of the playlist. The currently + active file is marked with an asterisk. + [/description] diff --git a/play.c b/play.c index 4545502b..1c1d809a 100644 --- a/play.c +++ b/play.c @@ -7,7 +7,6 @@ /** \file play.c Paraslash's standalone player. */ #include -#include #include #include #include @@ -837,24 +836,16 @@ static int com_tasks(struct play_task *pt, int argc, __a_unused char **argv) return 0; } -static int com_ls(struct play_task *pt, int argc, char **argv) +static int com_ls(struct play_task *pt, + __a_unused struct lls_parse_result *lpr) { - int i, j, ret; + int i; - if (argc == 1) { - FOR_EACH_PLAYLIST_FILE(i) - list_file(pt, i); - return 0; - } - for (j = 1; j < argc; j++) { - FOR_EACH_PLAYLIST_FILE(i) { - ret = fnmatch(argv[j], conf.inputs[i], 0); - if (ret == 0) /* match */ - list_file(pt, i); - } - } + FOR_EACH_PLAYLIST_FILE(i) + list_file(pt, i); return 0; } +EXPORT_PLAY_CMD_HANDLER(ls); static int com_play(struct play_task *pt, int argc, char **argv) { diff --git a/play.cmd b/play.cmd index 595d0f4a..799abbfd 100644 --- a/play.cmd +++ b/play.cmd @@ -2,12 +2,6 @@ BN: play SF: play.c SN: list of commands --- -N: ls -D: List playlist. -U: ls -H: This prints all paths of the playlist. The currently active file is -H: marked with an asterisk. ---- N: info D: Print information about the current file. U: info -- 2.39.2