bool at_prompt = false;
int tty_input = isatty(fileno(input));
int stat;
- btimer_t *tid;
+ btimer_t *tid=NULL;
for ( ;; ) {
if (at_prompt) { /* don't prompt multiple times */
break; /* error or interrupt */
} else if (stat == 0) { /* timeout */
if (strcmp(prompt, "*") == 0) {
- if (timeout) tid = start_bsock_timer(UA_sock, timeout);
+ tid = start_bsock_timer(UA_sock, timeout);
bnet_fsend(UA_sock, ".messages");
- if (timeout) stop_bsock_timer(tid);
+ stop_bsock_timer(tid);
} else {
continue;
}
}
continue;
}
- if (timeout) tid = start_bsock_timer(UA_sock, timeout);
+ tid = start_bsock_timer(UA_sock, timeout);
if (!bnet_send(UA_sock)) { /* send command */
- if (timeout) stop_bsock_timer(tid);
+ stop_bsock_timer(tid);
break; /* error */
}
- if (timeout) stop_bsock_timer(tid);
+ stop_bsock_timer(tid);
}
if (strcmp(UA_sock->msg, ".quit") == 0 || strcmp(UA_sock->msg, ".exit") == 0) {
break;
}
- if (timeout) tid = start_bsock_timer(UA_sock, timeout);
+ tid = start_bsock_timer(UA_sock, timeout);
while ((stat = bnet_recv(UA_sock)) >= 0) {
if (at_prompt) {
if (!stop) {
sendit(UA_sock->msg);
}
}
- if (timeout) stop_bsock_timer(tid);
+ stop_bsock_timer(tid);
if (usrbrk() > 1) {
break;
} else {