diff options
| author | Abdellah El Morabit <nsrddyn@gmail.com> | 2025-02-01 22:58:35 +0100 |
|---|---|---|
| committer | Abdellah El Morabit <nsrddyn@gmail.com> | 2025-02-01 22:58:35 +0100 |
| commit | cfee09646864f0e9426a1313250b2fe2e5cc4a84 (patch) | |
| tree | 41bc7f83b671f293ba153bc918de3f77f9d61a2f | |
| parent | 79ca071c71175ad00978d9995a7f8af49d46bda9 (diff) | |
made the echo function, working on saving echo variables, after this going to work on listing the working directory
| -rw-r--r-- | main.c | 39 | ||||
| -rw-r--r-- | variables.c | 7 |
2 files changed, 26 insertions, 20 deletions
@@ -1,5 +1,5 @@ -#include <stdio.h> #include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <readline/readline.h> #include <dirent.h> @@ -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 <stdlib.h> + +int main(int argc, char *argv) +{ + printf("Trying to save variables..."); + return 0; +} |
