]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - play.c
play: Convert com_info() to lopsub.
[paraslash.git] / play.c
diff --git a/play.c b/play.c
index 4545502bcf86c9042bfbfee5535b4b6b0fecc682..1700f9ac467eff2998af7321747360b994698c46 100644 (file)
--- a/play.c
+++ b/play.c
@@ -7,7 +7,6 @@
 /** \file play.c Paraslash's standalone player. */
 
 #include <regex.h>
-#include <fnmatch.h>
 #include <signal.h>
 #include <inttypes.h>
 #include <lopsub.h>
@@ -794,14 +793,13 @@ static int com_help(struct play_task *pt, struct lls_parse_result *lpr)
 }
 EXPORT_PLAY_CMD_HANDLER(help);
 
-static int com_info(struct play_task *pt, int argc, __a_unused char **argv)
+static int com_info(struct play_task *pt,
+               __a_unused struct lls_parse_result *lpr)
 {
        char *buf;
        size_t sz;
        static char dflt[] = "[no information available]";
 
-       if (argc != 1)
-               return -E_PLAY_SYNTAX;
        sz = xasprintf(&buf, "playlist_pos: %u\npath: %s\n",
                pt->current_file, conf.inputs[pt->current_file]);
        btr_add_output(buf, sz, pt->btrn);
@@ -809,6 +807,7 @@ static int com_info(struct play_task *pt, int argc, __a_unused char **argv)
        btr_add_output_dont_free(buf, strlen(buf), pt->btrn);
        return 0;
 }
+EXPORT_PLAY_CMD_HANDLER(info);
 
 static void list_file(struct play_task *pt, int num)
 {
@@ -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)
 {