libmpdserver

Parser combinator library for MPD client commands

git clone https://git.8pit.net/libmpdserver.git

 1#include "fns.h"
 2#include "mpc.h"
 3
 4mpdf_fold(count, MPD_ARG_EXPR mpd_opt_arg(MPD_ARG_STRING))
 5
 6static mpc_parser_t *
 7mpd_count(void)
 8{
 9	mpc_parser_t *group;
10
11	group = mpc_and(2, mpcf_snd_free, mpd_argument(mpc_string("group")),
12	                mpd_argument(mpd_tag_name()), free);
13
14	return mpc_and(3, mpdf_count, mpc_string("count"),
15	               mpd_argument(mpd_string()), mpc_maybe(group), free,
16	               free);
17}
18
19mpc_parser_t *
20mpd_database_cmds(void)
21{
22	return mpd_count();
23}