From cfee09646864f0e9426a1313250b2fe2e5cc4a84 Mon Sep 17 00:00:00 2001 From: Abdellah El Morabit Date: Sat, 1 Feb 2025 22:58:35 +0100 Subject: made the echo function, working on saving echo variables, after this going to work on listing the working directory --- main.c | 39 +++++++++++++++++++-------------------- variables.c | 7 +++++++ 2 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 variables.c diff --git a/main.c b/main.c index efc8c8e..49b0f0b 100644 --- a/main.c +++ b/main.c @@ -1,5 +1,5 @@ -#include #include +#include #include #include #include @@ -9,21 +9,11 @@ #define true 1 #define false 0 -/* SIGNALS */ -#define SIGHUP 1 /* Hang up the process */ -#define SIGINT 2 /* Interrupt the process */ -#define SIGQUIT 3 /* Quit the process */ -#define SIGILL 4 /* Illegal instruction. */ -#define SIGTRAP 5 /* Trace trap. */ -#define SIGABRT 6 /* Abort. */ - typedef struct { int process_id; } id; - - void process_execution(int id) { fork(); @@ -44,29 +34,38 @@ void err_sys(char *string) void PROCESS_PID() { + printf("PID %ld\n", (long)getpid()); } -void LIST_CURRENT_DIRECTORY(int argc, char *argv[]) +void list_directories() { - + } -void ECHO_INPUT(char *string) +char *save_variable(char* command, char *argv) { - printf("%s", string); + char *variable = (char *)malloc(sizeof(char)); + + if (strcmp(argv[0], "$") == 0) + { + while(*argv != ("/0")) + { + + } + } } -int loop_shell() +void ECHO_INPUT(char *command, char *argv) { - - - return 0; + if (strcmp(command, "echo") == 0) + { + printf("argv"); + } } int main(int argc, char *argv[]) { - int i = getpid(); printf("%d", i); diff --git a/variables.c b/variables.c new file mode 100644 index 0000000..ad36573 --- /dev/null +++ b/variables.c @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv) +{ + printf("Trying to save variables..."); + return 0; +} -- cgit v1.2.3-70-g09d2