commit - 60697f73c63148dc7e11829ab5c3180a72b6d1f6
commit + 63dd8e70ee4fb313ea8fe0157fc55f0bd41ffd24
blob - aa433a02f0e66c2ac6450ca7bb10afa76c2f3bde
blob + 34b798a0bc69c9ebf40a1b7b000d53a19d552634
--- amused.c
+++ amused.c
void
main_send_playlist(struct imsgev *iev)
{
- char path[PATH_MAX];
+ struct player_status s;
size_t i;
for (i = 0; i < playlist.len; ++i) {
- strlcpy(path, playlist.songs[i], sizeof(path));
- imsg_compose_event(iev, IMSG_CTL_SHOW, 0, 0, -1, path,
- sizeof(path));
+ memset(&s, 0, sizeof(s));
+ strlcpy(s.path, playlist.songs[i], sizeof(s.path));
+ s.status = play_off == i ? STATE_PLAYING : STATE_STOPPED;
+ imsg_compose_event(iev, IMSG_CTL_SHOW, 0, 0, -1, &s,
+ sizeof(s));
}
imsg_compose_event(iev, IMSG_CTL_SHOW, 0, 0, -1, NULL, 0);
blob - 402b9f1d98e2f94cf7e04c0e5638b36b993c890e
blob + 4d52664ae3db887063c53cdee56f05de8970a9c6
--- ctl.c
+++ ctl.c
static int
show_complete(struct imsg *imsg, int *ret)
{
+ struct player_status s;
size_t datalen;
- char path[PATH_MAX];
if (imsg->hdr.type == IMSG_CTL_ERR) {
print_error_message("show failed", imsg);
if (datalen == 0)
return 1;
- if (datalen != sizeof(path))
+ if (datalen != sizeof(s))
fatalx("%s: data size mismatch", __func__);
- memcpy(path, imsg->data, sizeof(path));
- if (path[datalen-1] != '\0')
+ memcpy(&s, imsg->data, sizeof(s));
+ if (s.path[sizeof(s.path)-1] != '\0')
fatalx("%s: data corrupted?", __func__);
- printf("%s\n", path);
+ printf("%s %s\n", s.status == STATE_PLAYING ? ">" : " ", s.path);
return 0;
}