Pretty straight-forward conversion since the command does not have
any arguments. In the callback handler, we we can't return directly
any more since we need to free the serialized parse result.
static int com_select_callback(struct afs_callback_arg *aca)
{
static int com_select_callback(struct afs_callback_arg *aca)
{
- const char *arg = aca->query.data;
+ const struct lls_command *cmd = SERVER_CMD_CMD_PTR(SELECT);
+ const char *arg;
+ ret = lls_deserialize_parse_result(aca->query.data, cmd, &aca->lpr);
+ assert(ret >= 0);
+ arg = lls_input(0, aca->lpr);
ret = clear_score_table();
if (ret < 0) {
ret = clear_score_table();
if (ret < 0) {
- para_printf(&aca->pbout, "could not clear score table: %s\n",
- para_strerror(-ret));
- return ret;
+ para_printf(&aca->pbout, "could not clear score table\n");
+ goto free_lpr;
}
if (current_play_mode == PLAY_MODE_MOOD)
close_current_mood();
}
if (current_play_mode == PLAY_MODE_MOOD)
close_current_mood();
out:
para_printf(&aca->pbout, "activated %s (%d admissible files)\n",
current_mop? current_mop : "dummy mood", num_admissible);
out:
para_printf(&aca->pbout, "activated %s (%d admissible files)\n",
current_mop? current_mop : "dummy mood", num_admissible);
+free_lpr:
+ lls_free_parse_result(aca->lpr, cmd);
-int com_select(struct command_context *cc)
+static int com_select(struct command_context *cc, struct lls_parse_result *lpr)
- struct osl_object query;
+ const struct lls_command *cmd = SERVER_CMD_CMD_PTR(SELECT);
+ char *errctx;
+ int ret = lls(lls_check_arg_count(lpr, 1, 1, &errctx));
- if (cc->argc != 2)
- return -E_AFS_SYNTAX;
- query.data = cc->argv[1];
- query.size = strlen(cc->argv[1]) + 1;
- return send_callback_request(com_select_callback, &query,
- &afs_cb_result_handler, cc);
+ if (ret < 0) {
+ send_errctx(cc, errctx);
+ return ret;
+ }
+ return send_lls_callback_request(com_select_callback, cmd, lpr, cc);
+EXPORT_SERVER_CMD_HANDLER(select);
static void init_admissible_files(char *arg)
{
static void init_admissible_files(char *arg)
{
H: (?) metacharacter, nor by a bracket expression ([]) containing
H: a slash (see fnmatch(3)).
---
H: (?) metacharacter, nor by a bracket expression ([]) containing
H: a slash (see fnmatch(3)).
---
-N: select
-P: AFS_READ | AFS_WRITE
-D: Activate a mood or a playlist.
-U: select specifier/name
-H: The specifier is either 'm' or 'p' to indicate whether a playlist or
-H: a mood should be activated. Example:
-H:
-H: select m/foo
-H:
-H: loads the mood named 'foo'.
----
T: add
N: add@member@
O: int com_add@member@(struct command_context *cc);
T: add
N: add@member@
O: int com_add@member@(struct command_context *cc);
about the removed attributes in the audio file table is lost.
[/description]
about the removed attributes in the audio file table is lost.
[/description]
+[subcommand select]
+ purpose = activate a mood or a playlist
+ non-opts-name = specifier/name
+ aux_info = AFS_READ | AFS_WRITE
+ [description]
+ The specifier is either 'm' or 'p' to indicate whether a playlist or
+ a mood should be activated. Example:
+
+ select m/foo
+
+ activates the mood named 'foo'.
+ [/description]
+
[subcommand sender]
purpose = control paraslash senders
synopsis = [sender cmd [arguments]]
[subcommand sender]
purpose = control paraslash senders
synopsis = [sender cmd [arguments]]