From 4bbc5f0e0843fe9acdc15eaf24afaf423e27d08f Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Mon, 19 Aug 2024 11:24:47 +0800 Subject: [PATCH] add libxml2 build shell script --- booster/test/comport.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/booster/test/comport.c b/booster/test/comport.c index 267a94c..df216dc 100644 --- a/booster/test/comport.c +++ b/booster/test/comport.c @@ -1,15 +1,15 @@ /********************************************************************************* - * Copyright: (C) 2021 Guo Wenxue <guowenxue@gmail.com> + * Copyright: (C) 2021 Guo Wenxue <guowenxue@gmail.com> * All rights reserved. * * Filename: comport.c - * Description: This file used to do ioctl() on common device or communicate + * Description: This file used to do ioctl() on common device or communicate * with serial port/TTY device. - * + * * Version: 1.0.0(5/1/2021~) * Author: Guo Wenxue <guowenxue@gmail.com> * ChangeLog: 1, Release initial version on "5/1/2021 10:08:05 AM" - * + * ********************************************************************************/ #include <getopt.h> #include <libgen.h> @@ -60,7 +60,7 @@ case 'd': dev_name = optarg; break; - + case 'b': baudrate = atoi(optarg); break; @@ -211,7 +211,7 @@ void stdin_nonblock(void) { struct termios ttystate; - + //get the terminal state tcgetattr(STDIN_FILENO, &ttystate); @@ -219,21 +219,21 @@ ttystate.c_lflag &= ~ICANON; //minimum of number input read. ttystate.c_cc[VMIN] = 1; - + //set the terminal attributes. tcsetattr(STDIN_FILENO, TCSANOW, &ttystate); -} - +} + int kbhit(void) -{ +{ struct timeval tv; fd_set fds; - tv.tv_sec = 0; - tv.tv_usec = 0; + tv.tv_sec = 0; + tv.tv_usec = 0; FD_ZERO(&fds); FD_SET(STDIN_FILENO, &fds); //STDIN_FILENO is 0 select(STDIN_FILENO + 1, &fds, NULL, NULL, &tv); return FD_ISSET(STDIN_FILENO, &fds); -} +} -- Gitblit v1.9.1