1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2020 Dmitry Kozlyuk
9 #include "cmdline_private.h"
12 terminal_adjust(struct cmdline *cl)
16 tcgetattr(0, &cl->oldterm);
18 memcpy(&term, &cl->oldterm, sizeof(term));
19 term.c_lflag &= ~(ICANON | ECHO | ISIG);
20 tcsetattr(0, TCSANOW, &term);
26 terminal_restore(const struct cmdline *cl)
28 tcsetattr(fileno(stdin), TCSANOW, &cl->oldterm);
32 cmdline_poll_char(struct cmdline *cl)
40 return poll(&pfd, 1, 0);
44 cmdline_read_char(struct cmdline *cl, char *c)
46 return read(cl->s_in, c, 1);
50 cmdline_vdprintf(int fd, const char *format, va_list op)
52 return vdprintf(fd, format, op);