aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-09-02 11:10:49 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-09-02 11:10:49 +0300
commite27a9d5f173f7626c576dbb2cd4c2f373edc847b (patch)
tree75e551e26e29f5d76e3e1496a072a5edd49d1610
parent8dc46c9a698401f43a315e49c84851ba94423d30 (diff)
downloadyou86-e27a9d5f173f7626c576dbb2cd4c2f373edc847b.tar
you86-e27a9d5f173f7626c576dbb2cd4c2f373edc847b.tar.gz
you86-e27a9d5f173f7626c576dbb2cd4c2f373edc847b.zip
(1) Updated some formatting and naming
-rw-r--r--src/commandHandler.c6
-rw-r--r--src/commandHandler.h4
-rw-r--r--src/commandRouter.c8
-rw-r--r--src/defaultCommands.c12
-rw-r--r--src/main.c6
5 files changed, 18 insertions, 18 deletions
diff --git a/src/commandHandler.c b/src/commandHandler.c
index 9d158f3..54b0c7f 100644
--- a/src/commandHandler.c
+++ b/src/commandHandler.c
@@ -4,10 +4,10 @@ struct CommandHandler handlers[MAX_HANDLERS];
int handlerCount = 0;
-void registerHandler(char *name, F_EXECUTOR executor) {
+void registerHandler(char *p_name, P_EXECUTOR p_executor) {
struct CommandHandler newCH;
- newCH.p_name = name;
- newCH.p_executor = executor;
+ newCH.p_name = p_name;
+ newCH.p_executor = p_executor;
handlers[handlerCount++] = newCH;
}
diff --git a/src/commandHandler.h b/src/commandHandler.h
index d344abb..fc2f084 100644
--- a/src/commandHandler.h
+++ b/src/commandHandler.h
@@ -3,11 +3,11 @@
#define MAX_HANDLERS 32
-typedef void (*F_EXECUTOR)(char *);
+typedef void (*P_EXECUTOR)(char *);
struct CommandHandler {
char *p_name;
- F_EXECUTOR p_executor;
+ P_EXECUTOR p_executor;
};
#endif
diff --git a/src/commandRouter.c b/src/commandRouter.c
index 3d41ddd..baf04c2 100644
--- a/src/commandRouter.c
+++ b/src/commandRouter.c
@@ -7,12 +7,12 @@
extern struct CommandHandler handlers[MAX_HANDLERS];
extern int handlerCount;
-bool route(char *command) {
- command = strtok(command, " ");
+bool route(char *p_command) {
+ p_command = strtok(p_command, " ");
for (int i = 0; i < handlerCount; i++) {
- if (strcasecmp(handlers[i].p_name, command) == 0) {
- handlers[i].p_executor(command);
+ if (strcasecmp(handlers[i].p_name, p_command) == 0) {
+ handlers[i].p_executor(p_command);
return true;
}
}
diff --git a/src/defaultCommands.c b/src/defaultCommands.c
index c5c927a..74415da 100644
--- a/src/defaultCommands.c
+++ b/src/defaultCommands.c
@@ -2,23 +2,23 @@
#include <stdio.h>
#include <stdlib.h>
-void help(char *args) {
+void help(char *p_args) {
printf("This is the help message");
}
-void about(char *args) {
+void about(char *p_args) {
printf("This is the about message");
}
-void version(char *args) {
+void version(char *p_args) {
printf("This is the version message");
}
-void exitApp(char *args) {
- exit(0);
+void exitApp(char *p_args) {
+ exit(EXIT_SUCCESS);
}
-extern void registerHandler(char *name, F_EXECUTOR executor);
+extern void registerHandler(char *, P_EXECUTOR);
void registerDefaultHandlers() {
registerHandler("help", &help);
diff --git a/src/main.c b/src/main.c
index 303efea..5697352 100644
--- a/src/main.c
+++ b/src/main.c
@@ -23,9 +23,9 @@ int main() {
printf("Welcome!\n\n");
do {
// Removes the Line Feed character at the "end", if it exists
- char *toChange = strchr(buffer, 0x0A);
- if (toChange != NULL)
- toChange[0] = 0;
+ char *p_toChange = strchr(buffer, 0x0A);
+ if (p_toChange != NULL)
+ p_toChange[0] = 0;
if (buffer[0] > 0)
if (route(buffer))