From 740efa6658c17158058f161b0230b7718b6bd051 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 2 Sep 2021 08:44:13 +0300 Subject: (1) Added current implementations: shell input handling --- commandRouter.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 commandRouter.c (limited to 'commandRouter.c') diff --git a/commandRouter.c b/commandRouter.c new file mode 100644 index 0000000..3d41ddd --- /dev/null +++ b/commandRouter.c @@ -0,0 +1,20 @@ +#include +#include +#include +#include +#include "commandHandler.h" + +extern struct CommandHandler handlers[MAX_HANDLERS]; +extern int handlerCount; + +bool route(char *command) { + command = strtok(command, " "); + + for (int i = 0; i < handlerCount; i++) { + if (strcasecmp(handlers[i].p_name, command) == 0) { + handlers[i].p_executor(command); + return true; + } + } + return false; +} -- cgit v1.2.3