commit 516c9d2a0b2afa1c10aa66bf45b2f9f09d5ae946
parent 87e7106e4c7c56839916c1643178e3451d90ae49
Author: Jacob R. Edwards <n/a>
Date: Fri, 13 May 2022 18:14:28 -0500
Add command to list commands
Diffstat:
3 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/aps/command.c b/aps/command.c
@@ -266,3 +266,14 @@ com_terminate(struct aps *aps, int fd, int argc, char **argv)
aps->close = 1;
return NULL;
}
+
+char *
+com_commands(struct aps *aps, int fd, int argc, char **argv)
+{
+ int i;
+
+ for (i = 0; i < aps->ncoms; ++i)
+ if (respadd(aps, fd, aps->coms[i].name))
+ return errstr;
+ return NULL;
+}
diff --git a/aps/command.h b/aps/command.h
@@ -19,3 +19,4 @@ char *com_log(struct aps *, int, int, char **);
char *com_player(struct aps *, int, int, char **);
char *com_truncate(struct aps *, int, int, char **);
char *com_terminate(struct aps *, int, int, char **);
+char *com_commands(struct aps *, int, int, char **);
diff --git a/aps/main.c b/aps/main.c
@@ -40,6 +40,7 @@
static struct aps *aps;
static struct command commands[] = {
{ "add", com_add },
+ { "commands", com_commands },
{ "list", com_list },
{ "log", com_log },
{ "name", com_name },