all repos — hex @ 17551dc743e5060b1baccdf730b76ef9a5f0603e

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Handled gets in emscripten.
h3rald h3rald@h3rald.com
Mon, 02 Dec 2024 11:32:46 +0000
commit

17551dc743e5060b1baccdf730b76ef9a5f0603e

parent

9a2ca6b08ffdb7ba30d6986e2d7aaed4b4bfa665

1 files changed, 7 insertions(+), 1 deletions(-)

jump to
M hex.chex.c

@@ -1231,8 +1231,14 @@ int hex_symbol_gets(hex_context_t *ctx)

{ char input[HEX_STDIN_BUFFER_SIZE]; // Buffer to store the input (adjust size if needed) + char *p = input; +#ifdef EMSCRIPTEN + p = em_fgets(input, 1024); +#else + p = fgets(input, sizeof(input), stdin); +#endif - if (fgets(input, sizeof(input), stdin) != NULL) + if (p != NULL) { // Strip the newline character at the end of the string input[strcspn(input, "\n")] = '\0';