This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository eshell.

View the commit online.

commit 7a02f0520f57c3de42b1777230a7ad49d3a66f39
Author: swagtoy <m...@ow.swag.toys>
AuthorDate: Fri Oct 25 18:04:52 2024 -0400

    eshell: Basic loop
---
 eshell/CMakeLists.txt |  2 +-
 eshell/src/eshell.c   | 21 +++++++++++++++++++--
 eshell/src/eshell.h   |  3 ++-
 eshell/src/main.c     |  9 ++++++++-
 4 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/eshell/CMakeLists.txt b/eshell/CMakeLists.txt
index de1bfda..bdaac73 100644
--- a/eshell/CMakeLists.txt
+++ b/eshell/CMakeLists.txt
@@ -8,7 +8,7 @@ find_package(PkgConfig)
 pkg_check_modules(EFL REQUIRED efl ecore)
 
 add_executable(Eshell
-	src/main.c)
+	src/main.c src/eshell.c)
 
 set_target_properties(Eshell PROPERTIES OUTPUT_NAME "eshell")
 target_include_directories(Eshell PUBLIC
diff --git a/eshell/src/eshell.c b/eshell/src/eshell.c
index 1193e50..01b7f91 100644
--- a/eshell/src/eshell.c
+++ b/eshell/src/eshell.c
@@ -4,9 +4,26 @@
  * Main shell loop. 
  */
 
+#include <stdio.h>
 #include "eshell.h"
 
-void init(struct Eshell* env, int argc, char* argv)
+int eshell_init(struct Eshell* eshell, int argc, char** argv)
 {
-
+	return 0;
+}
+
+int eshell_io_loop(struct Eshell* eshell)
+{
+	char in[512] = {0};
+	while (1)
+	{
+		fputs("> ", stdout);
+		char* res = fgets(in, 512, stdin);
+		if (!res)
+		{
+			return 1;
+		}
+		puts(res);
+	}
+	return 0;
 }
diff --git a/eshell/src/eshell.h b/eshell/src/eshell.h
index f9eab2f..df30f0c 100644
--- a/eshell/src/eshell.h
+++ b/eshell/src/eshell.h
@@ -10,6 +10,7 @@ struct Eshell
 	char* prompt;
 };
 
-void init(struct Eshell* env, int argc, char* argv);
+int eshell_init(struct Eshell* env, int argc, char** argv);
+int eshell_io_loop(struct Eshell* env);
 
 #endif
diff --git a/eshell/src/main.c b/eshell/src/main.c
index 09ec2e0..7d3c54b 100644
--- a/eshell/src/main.c
+++ b/eshell/src/main.c
@@ -2,6 +2,8 @@
 #include <Ecore.h>
 #include <Ecore_Getopt.h>
 
+#include "eshell.h"
+
 static const Ecore_Getopt options = {
 	"Eshell",
 	"%prog [options] <filename>",
@@ -36,7 +38,12 @@ main(int argc, char** argv)
 	
 	ecore_app_args_set(argc, (const char**)argv);
 	int args = ecore_getopt_parse(&options, values, argc, argv);
-	if (args == 1)
+	if (args != 1)
 		ecore_getopt_help(stderr, &options);
+	else {
+		struct Eshell* eshell;
+		eshell_init(eshell, argc, argv);
+		eshell_io_loop(eshell);
+	}
 	return 0;
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to