commit 42af2efcf5845f8c892c83a979e1adf262a1bff1
parent fd64fec3514a496b7e716a358f4b27c6ecdd9290
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Thu, 20 May 2021 15:44:55 -0700
Allow any player name
Use the first element of player as the filename and the second as
the beginning of it's arguments.
Diffstat:
4 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/aps.c b/aps.c
@@ -182,11 +182,12 @@ main(int argc, char *argv[])
signal(SIGINT, sigclose);
signal(SIGTERM, sigclose);
- for (i = 0; player[i]; ++i)
+ for (i = 1; player[i]; ++i)
if (!player[i][0])
player[i] = aps.player.path;
- aps.player.argv = player;
+ aps.player.argv = player + 1;
+ aps.player.prog = player[0];
aps.player.state = STOPPED;
strcpy(aps.next, "+1");
diff --git a/config.def.h b/config.def.h
@@ -1,5 +1,7 @@
static char *address = "/tmp/aps";
+
static char *player[] = {
/* "" = path */
- "ffplay", "-loglevel", "error", "-nodisp", "", NULL
+ /* prog, arg, ... */
+ "ffplay", "apsplayer", "-loglevel", "error", "-nodisp", "", NULL
};
diff --git a/player.c b/player.c
@@ -45,8 +45,8 @@ pstart(struct player *p)
return 0;
}
- execvp(*p->argv, p->argv);
- perror(*p->argv);
+ execvp(p->prog, p->argv);
+ perror(p->prog);
_exit(1);
}
diff --git a/player.h b/player.h
@@ -6,6 +6,7 @@ enum player_state {
struct player {
char **argv;
+ char *prog;
char path[PATH_MAX];
int state;
pid_t pid;