diff options
| author | nasrlol <nsrddyn@gmail.com> | 2025-02-18 22:56:09 +0100 |
|---|---|---|
| committer | nasrlol <nsrddyn@gmail.com> | 2025-02-18 22:56:09 +0100 |
| commit | 6d0a41b2c3400ffc2d98edc0ea727e53760b2b7b (patch) | |
| tree | be6500dc97b26c37e17eb0104b450a05e2a634cb | |
| parent | d5ad52317a8abdfaa5237cf326ce718d6f75eedf (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.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -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 |
