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 9ddeb958ee88b0811bdc03dadcba4b5a660164f1
Author: swagtoy <m...@ow.swag.toys>
AuthorDate: Sat Oct 26 18:18:33 2024 -0400

    eshell: Remove newline from input
---
 eshell/src/eshell.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/eshell/src/eshell.c b/eshell/src/eshell.c
index 72d4cdf..d0c7284 100644
--- a/eshell/src/eshell.c
+++ b/eshell/src/eshell.c
@@ -5,6 +5,7 @@
  */
 
 #include <stdio.h>
+#include <string.h>
 #include "eshell.h"
 
 int eshell_init(struct Eshell* eshell, int argc, char** argv)
@@ -19,12 +20,18 @@ int eshell_io_loop(struct Eshell* eshell)
 	{
 		fputs("> ", stdout);
 		char* res = fgets(in, 512, stdin);
+		// TODO better way to do this?
+		size_t res_len = res ? strlen(res) : 0;
 		if (res == NULL)
 		{
 			// EOL, we hope
 			puts("");
 			return -1;
 		}
+		
+		if (res[res_len-1] == '\n')
+			res[res_len-1] = '\0';
+		
 		puts(res);
 	}
 	return 0;

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

Reply via email to