Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright (c) 2020 Dmitry Kozlyuk 3 : : */ 4 : : 5 : : #include <poll.h> 6 : : #include <string.h> 7 : : #include <unistd.h> 8 : : 9 : : #include "cmdline_private.h" 10 : : 11 : : void 12 : 1 : terminal_adjust(struct cmdline *cl) 13 : : { 14 : : struct termios term; 15 : : 16 : 1 : tcgetattr(0, &cl->oldterm); 17 : : 18 : : memcpy(&term, &cl->oldterm, sizeof(term)); 19 : 1 : term.c_lflag &= ~(ICANON | ECHO | ISIG); 20 : 1 : tcsetattr(0, TCSANOW, &term); 21 : : 22 : 1 : setbuf(stdin, NULL); 23 : 1 : } 24 : : 25 : : void 26 : 1 : terminal_restore(const struct cmdline *cl) 27 : : { 28 : 1 : tcsetattr(fileno(stdin), TCSANOW, &cl->oldterm); 29 : 1 : } 30 : : 31 : : ssize_t 32 : 5 : cmdline_read_char(struct cmdline *cl, char *c) 33 : : { 34 [ + - ]: 5 : return read(cl->s_in, c, 1); 35 : : } 36 : : 37 : : int 38 : 0 : cmdline_vdprintf(int fd, const char *format, va_list op) 39 : : { 40 : 0 : return vdprintf(fd, format, op); 41 : : } 42 : : 43 : : /* This function is not needed on Linux, instead use sigaction() */ 44 : : void 45 : 1 : cmdline_cancel(__rte_unused struct cmdline *cl) 46 : : { 47 : 1 : }