summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAbdellah El Morabit <nsrddyn@gmail.com>2025-02-22 22:45:53 +0100
committerAbdellah El Morabit <nsrddyn@gmail.com>2025-02-22 22:45:53 +0100
commitc97a0699cffb4070d2e49cdab7bda6a185140b71 (patch)
treeb2fa3c0292a7ae8876e310c35e2d05b94b1fa025 /main.c
parent054e9d7393bac2f51be121308f5f3916ad9ab875 (diff)
splitting the argument into the source and detination
Diffstat (limited to 'main.c')
-rw-r--r--main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/main.c b/main.c
index 14c8861..63b1e3d 100644
--- a/main.c
+++ b/main.c
@@ -88,6 +88,21 @@ struct command split_command(char *input) {
return user_command;
}
+struct split_arg split_argument(struct command argument) {
+ struct split_arg new_argument = {};
+
+ char *source = strtok(argument.arg, " ");
+ char *destination = strtok(NULL, " ");
+
+ if (source != NULL) {
+ new_argument.source = source;
+ }
+ if (destination != NULL) {
+ new_argument.destination = destination;
+ }
+ return new_argument;
+}
+
void exec_command(char *input) {
const struct command user_command = split_command(input);