summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAbdellah El Morabit <nsrddyn@gmail.com>2025-02-19 11:35:14 +0100
committerAbdellah El Morabit <nsrddyn@gmail.com>2025-02-19 11:35:14 +0100
commit61359f6e6656a6996c8de3d95c622b65a2a00b3b (patch)
treed96f5b0852f60560e47800523bf538bbedc4208f /main.c
parente7cf82f0a98d238cf3b6b6fd9a817714fb2cb81a (diff)
had to update the way the pwd command and the echo command work because of the new code design, echo now has a seperate function and pwd has to take in an argument and then cancel it, this is because of the code structure i commited earlier but instead of making a seperate code structure for every type of command ill just handle it in the commands that dont need it
Diffstat (limited to 'main.c')
-rw-r--r--main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/main.c b/main.c
index 1eba34b..5744178 100644
--- a/main.c
+++ b/main.c
@@ -178,7 +178,15 @@ void clear(const char *arg) {
printf("\033[3J");
}
-char *print_cdirectory() {
+void echo(const char *arg) {
+ printf("%s", arg);
+}
+
+void print_cdirectory(const char *arg) {
+ if (arg != NULL) {
+ printf("print_cdirectory doesn't support any arguments, see help() for help");
+ return;
+ }
char *current_working_directory = getcwd(NULL, 0);
/* getcwd() command already allocates malloc for the path that should be returned,
to do: should I free it when finished or not?/