From 6d0a41b2c3400ffc2d98edc0ea727e53760b2b7b Mon Sep 17 00:00:00 2001 From: nasrlol Date: Tue, 18 Feb 2025 22:56:09 +0100 Subject: 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 --- main.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'main.c') 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 -- cgit v1.2.3-70-g09d2