You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/08 13:58:17 UTC

[incubator-nuttx-apps] branch master updated: Shouldn't use local readline in telnet

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new f14aead  Shouldn't use local readline in telnet
f14aead is described below

commit f14aead53eee2e4e13d7421066e593ed6b0db2e9
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Feb 5 13:53:30 2020 +0800

    Shouldn't use local readline in telnet
    
    Shouldn't use local readline in telnet since the host has more powerful intelligent
---
 system/telnet/telnet_client.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/system/telnet/telnet_client.c b/system/telnet/telnet_client.c
index 04c17a7..eed0675 100644
--- a/system/telnet/telnet_client.c
+++ b/system/telnet/telnet_client.c
@@ -71,7 +71,6 @@
 #  include "zlib.h"
 #endif
 
-#include "system/readline.h"
 #include "netutils/telnetc.h"
 
 /****************************************************************************
@@ -187,7 +186,7 @@ static void _event_handler(struct telnet_s *telnet,
     /* Data received */
 
     case TELNET_EV_DATA:
-      printf("%.*s", (int)ev->data.size, ev->data.buffer);
+      fwrite(ev->data.buffer, 1, ev->data.size, stdout);
       fflush(stdout);
       break;
 
@@ -400,7 +399,7 @@ int main(int argc, FAR char *argv[])
   /* Initialize poll descriptors */
 
   memset(pfd, 0, sizeof(pfd));
-  pfd[0].fd = 1;
+  pfd[0].fd = STDIN_FILENO;
   pfd[0].events = POLLIN;
   pfd[1].fd = sock;
   pfd[1].events = POLLIN;
@@ -413,7 +412,7 @@ int main(int argc, FAR char *argv[])
 
       if (pfd[0].revents & (POLLIN | POLLERR | POLLHUP))
         {
-          ret = std_readline(buffer, sizeof(buffer));
+          ret = read(STDIN_FILENO, buffer, sizeof(buffer));
           if (ret > 0)
             {
               send_local_input(buffer, ret);