From: Tomas Hlavacek Date: Sat, 6 Apr 2013 20:07:32 +0000 (+0200) Subject: Fix birdcl async message handling X-Git-Tag: v1.3.10~2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=568d9c9faeab70951d8e9bfea521e1b38a9a3d1c;p=thirdparty%2Fbird.git Fix birdcl async message handling Fix handling of async messafe in the bird light client. The async message may occure at the any moment so we need the client to liste for the message from server when it waits for user input. --- diff --git a/client/birdcl/client.c b/client/birdcl/client.c index 21b632706..1e920ce8b 100644 --- a/client/birdcl/client.c +++ b/client/birdcl/client.c @@ -36,7 +36,7 @@ static int once; extern char *server_path; extern int server_fd; -extern int nstate; +extern int cstate; extern int num_lines, skip_input, interactive; static int term_lns=25; @@ -123,7 +123,7 @@ run_init_cmd(void) return; } - if (!init_cmd && once && (nstate == STATE_CMD_USER)) + if (!init_cmd && once && (cstate == STATE_PROMPT)) { /* Initial command is finished and we want to exit */ cleanup(); @@ -332,7 +332,7 @@ server_got_reply(char *x) if (x[4] == ' ') { - nstate = STATE_CMD_USER; + cstate = STATE_PROMPT; skip_input = 0; return; } @@ -362,10 +362,10 @@ select_loop(void) { FD_ZERO(&select_fds); - if (nstate != STATE_CMD_USER) + if (cstate != STATE_CMD_USER) FD_SET(server_fd, &select_fds); - if (nstate != STATE_CMD_SERVER) + if (cstate != STATE_CMD_SERVER) { FD_SET(0, &select_fds); if (interactive)