+static void
+modcmd_describe_command(struct userNode *user, struct svccmd *cmd, struct svccmd *target) {
+ char buf1[MAXLEN], buf2[MAXLEN];
+ unsigned int ii, len, buf1_used, buf2_used;
+
+ if (target->alias.used) {
+ unsplit_string((char**)target->alias.list, target->alias.used, buf1);
+ reply("MCMSG_COMMAND_ALIASES", target->name, buf1);
+ } else {
+ snprintf(buf1, sizeof(buf1), "%s.%s", target->command->parent->name, target->command->name);
+ reply("MCMSG_COMMAND_BINDING", target->name, buf1);
+ }
+ for (ii = buf1_used = buf2_used = 0; modcmd_flags[ii].name; ++ii) {
+ const struct modcmd_flag *flag = &modcmd_flags[ii];
+ if (target->flags & flag->flag) {
+ if (buf1_used)
+ buf1[buf1_used++] = ',';
+ len = strlen(flag->name);
+ memcpy(buf1 + buf1_used, flag->name, len);
+ buf1_used += len;
+ } else if (target->effective_flags & flag->flag) {
+ if (buf2_used)
+ buf2[buf2_used++] = ',';
+ len = strlen(flag->name);
+ memcpy(buf2 + buf2_used, flag->name, len);
+ buf2_used += len;
+ }
+ }
+ if (buf1_used)
+ buf1[buf1_used] = '\0';
+ else
+ strcpy(buf1, user_find_message(user, "MSG_NONE"));
+ if (buf2_used)
+ buf2[buf2_used] = '\0';
+ else
+ strcpy(buf2, user_find_message(user, "MSG_NONE"));
+ reply("MCMSG_COMMAND_FLAGS", buf1, buf2);
+ for (ii = buf1_used = buf2_used = 0; handle_flags[ii]; ++ii) {
+ if (target->req_account_flags & (1 << ii))
+ buf1[buf1_used++] = handle_flags[ii];
+ else if (target->deny_account_flags & (1 << ii))
+ buf2[buf2_used++] = handle_flags[ii];
+ }
+ buf1[buf1_used] = buf2[buf2_used] = '\0';
+ reply("MCMSG_COMMAND_ACCOUNT_FLAGS", buf1, buf2);
+ reply("MCMSG_COMMAND_ACCESS_LEVEL", target->min_channel_access, target->min_opserv_level, target->min_staff_level);
+ reply("MCMSG_COMMAND_USES", target->name, target->uses);
+}
+