comparison calypso/tpinterf.c @ 7:b25d4dfe5798

fcsim-calypso-be actually works now
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 05:33:51 +0000
parents deeeef558279
children
comparison
equal deleted inserted replaced
6:0a21a7ffe144 7:b25d4dfe5798
134 tpinterf_pass_output(timeout) 134 tpinterf_pass_output(timeout)
135 { 135 {
136 char buf[1024], *cp; 136 char buf[1024], *cp;
137 fd_set fds; 137 fd_set fds;
138 struct timeval tv; 138 struct timeval tv;
139 int cc, newline = 1, termflag = 0; 139 int cc, newline = 1, termflag = 0, finish = 0;
140 unsigned goodchar; 140 unsigned goodchar;
141 141
142 for (goodchar = 0; ; ) { 142 for (goodchar = 0; !finish; ) {
143 FD_ZERO(&fds); 143 FD_ZERO(&fds);
144 FD_SET(target_fd, &fds); 144 FD_SET(target_fd, &fds);
145 tv.tv_sec = timeout; 145 tv.tv_sec = timeout;
146 tv.tv_usec = 0; 146 tv.tv_usec = 0;
147 cc = select(target_fd+1, &fds, NULL, NULL, &tv); 147 cc = select(target_fd+1, &fds, NULL, NULL, &tv);
162 "back end error: failed read after successful select\n"); 162 "back end error: failed read after successful select\n");
163 return(-1); 163 return(-1);
164 } 164 }
165 for (cp = buf + goodchar; cc; cp++) { 165 for (cp = buf + goodchar; cc; cp++) {
166 cc--; 166 cc--;
167 if (*cp == '=' && newline && !cc) 167 if (*cp == '=' && newline && !cc) {
168 finish = 1;
168 break; 169 break;
170 }
169 if (*cp == '\n') { 171 if (*cp == '\n') {
170 newline = 1; 172 newline = 1;
171 termflag = 1; 173 termflag = 1;
172 continue; 174 continue;
173 } 175 }