You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ya...@apache.org on 2020/04/16 11:50:51 UTC

[incubator-nuttx-apps] branch master updated: system/cu: Echo NULL char too

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

yamamoto 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 e4b101d  system/cu: Echo NULL char too
e4b101d is described below

commit e4b101d2ef33c97085c1912930066435d0e2ad2f
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Apr 15 10:32:13 2020 +0800

    system/cu: Echo NULL char too
    
    since zero is also a valid character
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 system/cu/cu_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/system/cu/cu_main.c b/system/cu/cu_main.c
index 1e0fc03..469063d 100644
--- a/system/cu/cu_main.c
+++ b/system/cu/cu_main.c
@@ -384,14 +384,14 @@ int main(int argc, FAR char *argv[])
     {
       int ch = getc(stdin);
 
-      if (nobreak == 1)
+      if (ch < 0)
         {
-          write(g_cu.outfd, &ch, 1);
           continue;
         }
 
-      if (ch <= 0)
+      if (nobreak == 1)
         {
+          write(g_cu.outfd, &ch, 1);
           continue;
         }