Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

tools: flterm: check logfd, check ascii, flush each line

  • Loading branch information...
commit 9aa4a6045c90d75ed71872162d73fdaa35557f63 1 parent 2353955
authored August 25, 2011 sbourdeauducq committed August 25, 2011

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. 7  tools/flterm.c
7  tools/flterm.c
@@ -24,6 +24,7 @@
24 24
 #include <sys/ioctl.h>
25 25
 #include <sys/time.h>
26 26
 #include <string.h>
  27
+#include <ctype.h>
27 28
 #include <termios.h>
28 29
 #include <fcntl.h>
29 30
 #include <unistd.h>
@@ -492,8 +493,10 @@ static void do_terminal(char *serial_port,
492 493
 		if(fds[1].revents & POLLIN) {
493 494
 			if(read(serialfd, &c, 1) <= 0) break;
494 495
 
495  
-			fwrite(&c, sizeof(c), 1, logfd);
496  
-			fflush(logfd);
  496
+			if(logfd != NULL) {
  497
+				if(isascii(c)) fwrite(&c, sizeof(c), 1, logfd);
  498
+				if(c == '\n') fflush(logfd);
  499
+			}
497 500
 
498 501
 			if(gdbfd != -1 && rsp_pending && (c == '+' || c == '-')) {
499 502
 				rsp_pending = 0;

0 notes on commit 9aa4a60

Please sign in to comment.
Something went wrong with that request. Please try again.