summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdellah El Morabit <nsrddyn@gmail.com>2025-02-01 22:58:35 +0100
committerAbdellah El Morabit <nsrddyn@gmail.com>2025-02-01 22:58:35 +0100
commitcfee09646864f0e9426a1313250b2fe2e5cc4a84 (patch)
tree41bc7f83b671f293ba153bc918de3f77f9d61a2f
parent79ca071c71175ad00978d9995a7f8af49d46bda9 (diff)
made the echo function, working on saving echo variables, after this going to work on listing the working directory
-rw-r--r--main.c39
-rw-r--r--variables.c7
2 files changed, 26 insertions, 20 deletions
diff --git a/main.c b/main.c
index efc8c8e..49b0f0b 100644
--- a/main.c
+++ b/main.c
@@ -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;
+}