diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-09-02 08:44:13 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-09-02 08:44:13 +0300 |
| commit | 740efa6658c17158058f161b0230b7718b6bd051 (patch) | |
| tree | bab8e9c1e8e65dad2428e51a5fa3a410daba1acf /commandRouter.c | |
| parent | f5e2da80d26c7ed8381cb31c2fde5aae67269952 (diff) | |
| download | you86-740efa6658c17158058f161b0230b7718b6bd051.tar you86-740efa6658c17158058f161b0230b7718b6bd051.tar.gz you86-740efa6658c17158058f161b0230b7718b6bd051.zip | |
(1) Added current implementations: shell input handling
Diffstat (limited to 'commandRouter.c')
| -rw-r--r-- | commandRouter.c | 20 |
1 files changed, 20 insertions, 0 deletions
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 <stdio.h> +#include <string.h> +#include <stdbool.h> +#include <strings.h> +#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; +} |
