1#include <stddef.h>
2#include <string.h>
3
4#include "fns.h"
5#include "mpc.h"
6
7static char *mpd_subsystems[] = {
8 "database", "update", "stored_playlist", "playlist",
9 "player", "mixer", "output", "options",
10 "partition", "sticker", "subscription", "message",
11};
12
13static mpc_parser_t *
14mpd_clearerror(void)
15{
16 return mpd_cmd_noarg("clearerror");
17}
18
19static mpc_parser_t *
20mpd_currentsong(void)
21{
22 return mpd_cmd_noarg("currentsong");
23}
24
25static mpc_parser_t *
26mpd_status(void)
27{
28 return mpd_cmd_noarg("status");
29}
30
31static mpc_parser_t *
32mpd_stats(void)
33{
34 return mpd_cmd_noarg("stats");
35}
36
37mpdf_fold(idle, mpd_opt_arg(MPD_ARG_STRING))
38
39static mpc_parser_t *
40mpd_idle(void)
41{
42 mpc_parser_t *subsys;
43 static mpd_string_array_t ary = MPD_STRING_ARY(mpd_subsystems);
44
45 subsys = mpc_check_with(mpd_string_case(), free, mpd_check_array, &ary,
46 "invalid subsystem");
47 return mpc_and(2, mpdf_idle, mpc_string("idle"),
48 mpc_maybe(mpd_argument(subsys)), free);
49}
50
51mpc_parser_t *
52mpd_status_cmds(void)
53{
54 return mpc_or(5, mpd_clearerror(), mpd_currentsong(), mpd_idle(),
55 mpd_status(), mpd_stats());
56}