diff options
author | Trumeet <yuuta@yuuta.moe> | 2022-07-27 16:23:22 -0700 |
---|---|---|
committer | Trumeet <yuuta@yuuta.moe> | 2022-07-27 16:23:22 -0700 |
commit | 1b9b47ddce6d9e17029efc79a459a7eb3238628c (patch) | |
tree | d36a765553fc00ae1a489cf80b236c643c05b35d /client/acronc/handler_stdin.c | |
parent | bf83b67c68f3111ea42e2916cb1ba782fe1e1a24 (diff) | |
download | acron-1b9b47ddce6d9e17029efc79a459a7eb3238628c.tar acron-1b9b47ddce6d9e17029efc79a459a7eb3238628c.tar.gz acron-1b9b47ddce6d9e17029efc79a459a7eb3238628c.tar.bz2 acron-1b9b47ddce6d9e17029efc79a459a7eb3238628c.zip |
feat(acronc): add Windows support
Diffstat (limited to 'client/acronc/handler_stdin.c')
-rw-r--r-- | client/acronc/handler_stdin.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 +} |