aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/command.c17
-rw-r--r--src/commands/command.h6
2 files changed, 23 insertions, 0 deletions
diff --git a/src/commands/command.c b/src/commands/command.c
new file mode 100644
index 0000000..ee53c90
--- /dev/null
+++ b/src/commands/command.c
@@ -0,0 +1,17 @@
+#include "../graphics/graphics.h"
+#include "../lib/lib.h"
+
+int32_t starts_with(const char *a, const char *b) {
+ if (strcmp(a, b, strlen(b)) == 0)
+ return 1
+ return 0
+}
+
+void exec_command(char *command) {
+ if (starts_with(command, "ls"))
+ terminal_write_string("// listing files");
+ else if (starts_with(command, "help"))
+ terminal_write_string("I can't help you write now");
+ else if (starts_with(command, "ping"))
+ terminal_write_string("pong!")
+}
diff --git a/src/commands/command.h b/src/commands/command.h
new file mode 100644
index 0000000..2a43416
--- /dev/null
+++ b/src/commands/command.h
@@ -0,0 +1,6 @@
+#ifndef MELVIX_COMMAND_H
+#define MELVIX_COMMAND_H
+
+void exec_command(char *command);
+
+#endif