From 2e7b3b4baad30271c4da230c95c5b4245f659e1a Mon Sep 17 00:00:00 2001 From: William Bell <62452284+Ugric@users.noreply.github.com> Date: Mon, 18 Aug 2025 06:38:30 +0100 Subject: [PATCH] fix for winblows --- src/shell.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/shell.c b/src/shell.c index 9ecf3b2..e2b2dde 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3,7 +3,10 @@ * * SPDX-License-Identifier: GPL-3.0-or-later */ +#if defined(_WIN32) || defined(_WIN64) +#else #include "../external/linenoise/linenoise.h" +#endif #include "./lexer/lexer.h" #include "./runtime/call/call.h" #include "./runtime/objects/functions/functions.h" @@ -96,6 +99,7 @@ int execute_code(FILE *stream, char *path, Stack *scope, return 0; } +#if defined(_WIN32) || defined(_WIN64) // Simple input function char *input(const char *prompt) { printf("%s", prompt); @@ -117,6 +121,7 @@ char *input(const char *prompt) { return buffer; } +#endif char *read_all_stdin(size_t *out_len) { size_t size = 1024; @@ -194,7 +199,11 @@ int shell() { memcpy(prompt, textBefore, strlen(textBefore)); memcpy(prompt + strlen(textBefore), indentStr, isz + 1); +#if defined(_WIN32) || defined(_WIN64) + char *inp = input(prompt); +#else char *inp = linenoise(prompt); +#endif free(prompt); if (!inp) { @@ -205,10 +214,13 @@ int shell() { free(indentStr); return 0; } +#if defined(_WIN32) || defined(_WIN64) +#else if (inp[0] != '\0') { // Optionally add line to history linenoiseHistoryAdd(inp); } +#endif // Append line to totranslate size_t length = strlen(inp);