aboutsummaryrefslogtreecommitdiff
path: root/client/acronc/handler_stdin.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/acronc/handler_stdin.c')
-rw-r--r--client/acronc/handler_stdin.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/client/acronc/handler_stdin.c b/client/acronc/handler_stdin.c
index 3ac307d..4b8d0b8 100644
--- a/client/acronc/handler_stdin.c
+++ b/client/acronc/handler_stdin.c
@@ -74,12 +74,20 @@ static void on_stdin(uv_stream_t *t, ssize_t nread, const uv_buf_t *buf) {
free(buf->base);
}
+int stdin_start(void) {
+ return uv_read_start((uv_stream_t *) &tty, on_alloc, on_stdin);
+}
+
+void stdin_stop(void) {
+ uv_read_stop((uv_stream_t *) &tty);
+}
+
int h_stdin(int (*on_input)(ac_request_t *req),
void (*on_close)(void)) {
cb_recv = on_input;
cb_close = on_close;
int r;
if ((r = uv_tty_init(loop, &tty, 0, 0))) return r;
- if ((r = uv_read_start((uv_stream_t *) &tty, on_alloc, on_stdin))) return r;
+ if ((r = stdin_start())) return r;
return 0;
} \ No newline at end of file