Skip to content

Commit

Permalink
tools: flterm: check logfd, check ascii, flush each line
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiangfu Liu authored and Sebastien Bourdeauducq committed Aug 25, 2011
1 parent 2353955 commit 9aa4a60
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/flterm.c
Expand Up @@ -24,6 +24,7 @@
#include <sys/ioctl.h>
#include <sys/time.h>
#include <string.h>
#include <ctype.h>
#include <termios.h>
#include <fcntl.h>
#include <unistd.h>
Expand Down Expand Up @@ -492,8 +493,10 @@ static void do_terminal(char *serial_port,
if(fds[1].revents & POLLIN) {
if(read(serialfd, &c, 1) <= 0) break;

fwrite(&c, sizeof(c), 1, logfd);
fflush(logfd);
if(logfd != NULL) {
if(isascii(c)) fwrite(&c, sizeof(c), 1, logfd);
if(c == '\n') fflush(logfd);
}

if(gdbfd != -1 && rsp_pending && (c == '+' || c == '-')) {
rsp_pending = 0;
Expand Down

0 comments on commit 9aa4a60

Please sign in to comment.