summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornasrlol <nsrddyn@gmail.com>2025-02-18 22:56:09 +0100
committernasrlol <nsrddyn@gmail.com>2025-02-18 22:56:09 +0100
commit6d0a41b2c3400ffc2d98edc0ea727e53760b2b7b (patch)
treebe6500dc97b26c37e17eb0104b450a05e2a634cb
parentd5ad52317a8abdfaa5237cf326ce718d6f75eedf (diff)
started on the optimization of the code, i didnt like the if ladder so now im working on altnerative and better way to do what it dit, this involves cycling thorgh a strutred array and executing the matching function, this should be more performant and give better code readability
also added function prototypes and figured out the feature scope of de software Signed-off-by: nasrlol <nsrddyn@gmail.com>
-rw-r--r--main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/main.c b/main.c
index 797329d..076d23c 100644
--- a/main.c
+++ b/main.c
@@ -17,6 +17,39 @@ void test() {
printf("\nprint to output");
}
+void exec_command(char *input) {
+ struct command NEW_COMMAND = {};
+
+ // cycle through the command array and find the matching command and execute it
+}
+
+
+// shell commands functions prototypes
+void list(const char *path);
+
+void make_dir(const char *path);
+
+void remove_dir(const char *path);
+
+void remove_file(const char *path);
+
+void copy_files(const char *source, const char *dest);
+
+void move_files(const char *source, const char *dest);
+
+char *print_cdirectory();
+
+void change_directory(const char *path);
+
+void clear();
+
+
+struct exec_command CommandsList[] = {
+ {"ls", ls},
+};
+
+
+// shell command functions
// ls command
// get the requested path and put it into a const later on when getting the user input