H: This adds new attributes to the attribute table. At most 64
H: attributes may be defined.
---
-N: rmatt
-P: AFS_READ | AFS_WRITE
-D: Remove attribute(s).
-U: rmatt pattern...
-H: Remove all attributes matching any given pattern. All information
-H: about this attribute in the audio file table is lost.
----
N: rm
P: AFS_READ | AFS_WRITE
D: Remove entries from the audio file table.
static int com_rmatt_callback(struct afs_callback_arg *aca)
{
+ const struct lls_command *cmd = SERVER_CMD_CMD_PTR(RMATT);
int ret;
struct pattern_match_data pmd = {
.table = attribute_table,
- .patterns = aca->query,
.loop_col_num = ATTCOL_BITNUM,
.match_col_num = ATTCOL_NAME,
.data = aca,
.action = remove_attribute
};
+ ret = lls(lls_deserialize_parse_result(aca->query.data, cmd, &aca->lpr));
+ assert(ret >= 0);
+ pmd.lpr = aca->lpr;
ret = for_each_matching_row(&pmd);
if (ret < 0)
goto out;
if (pmd.num_matches == 0)
ret = -E_NO_MATCH;
out:
+ lls_free_parse_result(aca->lpr, cmd);
return ret;
}
-int com_rmatt(struct command_context *cc)
+static int com_rmatt(struct command_context *cc, struct lls_parse_result *lpr)
{
- if (cc->argc < 2)
- return -E_ATTR_SYNTAX;
- return send_standard_callback_request(cc->argc - 1, cc->argv + 1,
- com_rmatt_callback, afs_cb_result_handler, cc);
+ const struct lls_command *cmd = SERVER_CMD_CMD_PTR(RMATT);
+ char *errctx;
+ int ret = lls(lls_check_arg_count(lpr, 1, INT_MAX, &errctx));
+
+ if (ret < 0) {
+ send_errctx(cc, errctx);
+ return ret;
+ }
+ return send_lls_callback_request(com_rmatt_callback, cmd, lpr, cc);
}
+EXPORT_SERVER_CMD_HANDLER(rmatt);
/**
* Return a binary representation of the given attribute value.
Set the 'P' (playing) bit of the vss status flags.
[/description]
+[subcommand rmatt]
+ purpose = remove attribute(s)
+ non-opts-name = pattern...
+ aux_info = AFS_READ | AFS_WRITE
+ [description]
+ Remove all attributes which match any given pattern. All information
+ about the removed attributes in the audio file table is lost.
+ [/description]
+
[subcommand sender]
purpose = control paraslash senders
synopsis = [sender cmd [arguments]]