xiaoxiang781216 commented on code in PR #8996:
URL: https://github.com/apache/nuttx/pull/8996#discussion_r1163170300


##########
arch/sim/src/sim/win/sim_hostuart.c:
##########
@@ -36,6 +42,8 @@ static HANDLE g_stdout_handle;
  * Public Functions
  ****************************************************************************/
 
+bool host_uart_checkin(int fd);

Review Comment:
   move the simple check function to the beginning?



##########
arch/sim/src/sim/win/sim_hostuart.c:
##########
@@ -94,12 +102,34 @@ int host_uart_puts(int fd, const char *buf, size_t size)
 
 int host_uart_gets(int fd, char *buf, size_t size)
 {
-  DWORD nread;
-  int ret;
+  INPUT_RECORD input[NUM_INPUT];
+  char *pos = buf;
+  DWORD ninput;
+  int i;
 
-  ret = ReadConsole(g_stdin_handle, buf, size, &nread, 0);
+  while (size > 0 && host_uart_checkin(fd))
+    {
+      ninput = size > NUM_INPUT ? NUM_INPUT : size;
+      if (ReadConsoleInput(g_stdin_handle,
+                           (void *)&input, ninput, &ninput) <= 0 ||

Review Comment:
   ```suggestion
                              &input, ninput, &ninput) <= 0 ||
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to