ap

An audio player suited to my tastes
Log | Files | Refs | README | LICENSE

commit 2bdaabf6f9f3e647b520e0ad7898ab0fb7b17c27
parent f3237dd1f92945e8adfb89cc124d41b3d16d99f5
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date:   Tue, 29 Jun 2021 23:24:31 -0700

Allow the first item to match in findpat

Diffstat:
Maps/command.c | 14+++++++++++++-
Maps/config.h | 2+-
2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/aps/command.c b/aps/command.c @@ -191,7 +191,7 @@ earg: } if (!isdigit(**argv)) { - return findpat(incr, incr(item), argv, argc, err); + return findpat(incr, item, argv, argc, err); } else { if (argc != 1) goto earg; @@ -271,10 +271,20 @@ aps_name(struct aps *aps, int s, int argc, char **argv) return NULL; } +struct item * +aps_incr(struct aps *aps) +{ + if (aps->nextlen > 1 && strcmp(aps->next[1], "-") == 0) + return item_prev(aps->queue.pos); + else + return item_next(aps->queue.pos); +} + char * aps_next(struct aps *aps, int s, int argc, char **argv) { int i; + struct item *start; if (argc > 1) { for (i = 0; i < argc; ++i) { @@ -288,6 +298,8 @@ aps_next(struct aps *aps, int s, int argc, char **argv) } pstop(&aps->player); + if ((start = aps_incr(aps))) + aps->queue.pos = start; return aps_play(aps, -1, aps->nextlen, aps->next); } diff --git a/aps/config.h b/aps/config.h @@ -5,7 +5,7 @@ static char *player[] = { }; static char *next[] = { - "config.h", "+", "1" + "config.h", "*" }; static int timeout = 250;