From e3403eb5db936bfe2d55ffdc2dec56a1b2070046 Mon Sep 17 00:00:00 2001
From: Johan Kanflo <watski@bitfuse.net>
Date: Tue, 10 Oct 2017 15:37:43 +0200
Subject: [PATCH] Added fflush for terminal echo (#455)

---
 examples/terminal/terminal.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/examples/terminal/terminal.c b/examples/terminal/terminal.c
index 6f8b940..f25293a 100644
--- a/examples/terminal/terminal.c
+++ b/examples/terminal/terminal.c
@@ -94,18 +94,23 @@ static void gpiomon()
     int i = 0;
     printf("\n\n\nWelcome to gpiomon. Type 'help<enter>' for, well, help\n");
     printf("%% ");
+    fflush(stdout); // stdout is line buffered
     while(1) {
         if (read(0, (void*)&ch, 1)) { // 0 is stdin
             printf("%c", ch);
+            fflush(stdout);
             if (ch == '\n' || ch == '\r') {
                 cmd[i] = 0;
                 i = 0;
                 printf("\n");
                 handle_command((char*) cmd);
                 printf("%% ");
+                fflush(stdout);
             } else {
                 if (i < sizeof(cmd)) cmd[i++] = ch;
             }
+        } else {
+            printf("You will never see this print as read(...) is blocking\n");
         }
     }
 }