summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake-build-debug/.ninja_depsbin15656 -> 19688 bytes
-rw-r--r--cmake-build-debug/.ninja_log14
-rw-r--r--cmake-build-debug/CMakeFiles/program.dir/main.c.obin11712 -> 0 bytes
-rw-r--r--cmake-build-debug/Testing/Temporary/LastTest.log4
-rwxr-xr-xcmake-build-debug/programbin52488 -> 52696 bytes
-rw-r--r--main.c26
6 files changed, 29 insertions, 15 deletions
diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps
index 50108e0..a496b3c 100644
--- a/cmake-build-debug/.ninja_deps
+++ b/cmake-build-debug/.ninja_deps
Binary files differ
diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log
index b1cc967..96ca768 100644
--- a/cmake-build-debug/.ninja_log
+++ b/cmake-build-debug/.ninja_log
@@ -7,3 +7,17 @@
240 370 1740221026029114077 program ddf45f8a5c0d42d
3 243 1740224227027392987 CMakeFiles/program.dir/main.c.o 857d70be1ede4dfe
243 395 1740224227267350516 program ddf45f8a5c0d42d
+6 229 1740254802938845002 CMakeFiles/program.dir/main.c.o 857d70be1ede4dfe
+229 364 1740254803161377753 program ddf45f8a5c0d42d
+2 53 1740254819648654296 CMakeFiles/program.dir/main.c.o 857d70be1ede4dfe
+53 82 1740254819699608732 program ddf45f8a5c0d42d
+5 280 1740255409965330176 CMakeFiles/program.dir/main.c.o 857d70be1ede4dfe
+281 412 1740255410240941618 program ddf45f8a5c0d42d
+1 202 1740255437104581673 CMakeFiles/program.dir/main.c.o 857d70be1ede4dfe
+202 308 1740255437305637510 program ddf45f8a5c0d42d
+2 41 1740255449001281837 CMakeFiles/program.dir/main.c.o 857d70be1ede4dfe
+42 70 1740255449040904723 program ddf45f8a5c0d42d
+1 222 1740256119969249200 CMakeFiles/program.dir/main.c.o 857d70be1ede4dfe
+223 352 1740256120190732751 program ddf45f8a5c0d42d
+1 211 1740257255120464172 CMakeFiles/program.dir/main.c.o 857d70be1ede4dfe
+211 340 1740257255330667633 program ddf45f8a5c0d42d
diff --git a/cmake-build-debug/CMakeFiles/program.dir/main.c.o b/cmake-build-debug/CMakeFiles/program.dir/main.c.o
deleted file mode 100644
index 0d8744f..0000000
--- a/cmake-build-debug/CMakeFiles/program.dir/main.c.o
+++ /dev/null
Binary files differ
diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log
index 73dbc88..56213aa 100644
--- a/cmake-build-debug/Testing/Temporary/LastTest.log
+++ b/cmake-build-debug/Testing/Temporary/LastTest.log
@@ -1,3 +1,3 @@
-Start testing: Feb 22 17:42 CET
+Start testing: Feb 22 21:47 CET
----------------------------------------------------------
-End testing: Feb 22 17:42 CET
+End testing: Feb 22 21:47 CET
diff --git a/cmake-build-debug/program b/cmake-build-debug/program
index cec25c4..66e8bbb 100755
--- a/cmake-build-debug/program
+++ b/cmake-build-debug/program
Binary files differ
diff --git a/main.c b/main.c
index da3d895..79117fa 100644
--- a/main.c
+++ b/main.c
@@ -31,6 +31,8 @@ struct command split_command(char *input);
void exec_command(char *input);
+void split_arg(struct command argument);
+
// shell commands functions prototypes
void list(const char *path);
@@ -38,11 +40,11 @@ void make_dir(const char *path);
void remove_file(const char *path);
-void remove_dir(const char *path); // trying to delete the folder and the files init recursivly
+void remove_dir(const char *path); // trying to delete the folder and the files init recursively
-void copy_files(const char *arg);
+void copy_files(struct split_arg);
-void move_files(const char *arg);
+void move_files(struct split_arg);
void print_cdirectory(const char *arg);
@@ -129,7 +131,7 @@ void list(const char *path) {
// check if the directory got opened successfully
if (dP == NULL) {
- perror("opendir");
+ perror("failed to open directory");
return;
}
@@ -140,14 +142,12 @@ void list(const char *path) {
closedir(dP);
}
-void remove_dir(const char *path)
-{
- if (rmdir(path) != 0){
+void remove_dir(const char *path) {
+ if (rmdir(path) != 0) {
perror("failed to delete the directory");
- }
- else if {
+ } else {
struct dirent *entry;
- DIR *dP = opendir(path);
+ const DIR *dP = opendir(path);
if (dP == NULL) {
perror("failed to open the directory to delete the files recursively");
@@ -176,14 +176,14 @@ void remove_file(const char *path) {
}
void change_ownership(const char *path) {
- if ((chmod(path,S_IRWXU) != 0)) {
+ if (chmod(path,S_IRWXU) != 0) {
perror("failed to get ownership of the file");
} else {
printf("file permissions updated successfully");
}
}
-void copy_files(const char *arg) {
+void copy_files(const struct split_arg argument) {
// split the argument into the source and destination
// make a copy of the source file in the destination file
int c;
@@ -225,7 +225,7 @@ void clear(const char *arg) {
}
void echo(const char *arg) {
- printf("%s", arg);
+ printf("%s\n", arg);
}
void exit_(const char *arg) {