- /* check response, 1s timeout */
- if ((sel = poll_input(comm, 1, 0)) < 1) {
- if (sel == 0)
- fprintf(stderr, "send_line: \"%s\" command response timeout\n", line);
- else
- perror("send_line: select");
- return(1);
- }
- fgets(s, sizeof(s), comm);
+ p=s;
+ /* read with timout for every character (necessary for go command) */
+ do {
+ /* check response, 1s timeout */
+ if ((sel = poll_input(comm, 1, 0)) < 1) {
+ *p = '\0';
+ /*DEBUG*/printf(">%s", s);
+ fflush(stdout);
+ if (sel == 0) {
+ fprintf(stderr, "send_line: \"%s\" command response timeout\n", line);
+ }
+ else
+ perror("send_line: select");
+ return(1);
+ }
+ /* read one character */
+ size = fread(p, 1, 1, comm);
+ p++;
+ } while (*(p-1) != '\n');
+
+ *p = '\0';