From 1b9b47ddce6d9e17029efc79a459a7eb3238628c Mon Sep 17 00:00:00 2001 From: Trumeet Date: Wed, 27 Jul 2022 16:23:22 -0700 Subject: feat(acronc): add Windows support --- client/acronc/handler_stdin.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'client/acronc/handler_stdin.c') diff --git a/client/acronc/handler_stdin.c b/client/acronc/handler_stdin.c index 4b8d0b8..fb7c87c 100644 --- a/client/acronc/handler_stdin.c +++ b/client/acronc/handler_stdin.c @@ -59,7 +59,11 @@ static void on_stdin(uv_stream_t *t, ssize_t nread, const uv_buf_t *buf) { uv_close((uv_handle_t *) t, on_close); return; } +#ifdef _WIN32 + buf->base[nread - 2] = '\0'; /* Remove junk and tailing \r\n */ +#else buf->base[nread - 1] = '\0'; /* Remove junk and tailing \n */ +#endif if ((++ id) > INT_MAX) { id = 0; } @@ -90,4 +94,4 @@ int h_stdin(int (*on_input)(ac_request_t *req), if ((r = uv_tty_init(loop, &tty, 0, 0))) return r; if ((r = stdin_start())) return r; return 0; -} \ No newline at end of file +} -- cgit v1.2.3