mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-08 12:18:42 +00:00
Client: Use exit status to report errors
When birdc is called with a command as an argument, it should set exit status to non-zero when BIRD replied with an error reply code. Thanks to Vincent Bernat and others for suggestion.
This commit is contained in:
parent
5ddf98f6bd
commit
9b0b2c0d41
@ -50,6 +50,7 @@ static byte *server_read_pos = server_read_buf;
|
|||||||
int init = 1; /* During intial sequence */
|
int init = 1; /* During intial sequence */
|
||||||
int busy = 1; /* Executing BIRD command */
|
int busy = 1; /* Executing BIRD command */
|
||||||
int interactive; /* Whether stdin is terminal */
|
int interactive; /* Whether stdin is terminal */
|
||||||
|
int last_code; /* Last return code */
|
||||||
|
|
||||||
static int num_lines, skip_input;
|
static int num_lines, skip_input;
|
||||||
int term_lns, term_cls;
|
int term_lns, term_cls;
|
||||||
@ -196,7 +197,7 @@ init_commands(void)
|
|||||||
{
|
{
|
||||||
/* Initial command is finished and we want to exit */
|
/* Initial command is finished and we want to exit */
|
||||||
cleanup();
|
cleanup();
|
||||||
exit(0);
|
exit((last_code < 8000) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
input_init();
|
input_init();
|
||||||
@ -283,6 +284,8 @@ server_got_reply(char *x)
|
|||||||
if (code)
|
if (code)
|
||||||
PRINTF(len, "%s\n", verbose ? x : x+5);
|
PRINTF(len, "%s\n", verbose ? x : x+5);
|
||||||
|
|
||||||
|
last_code = code;
|
||||||
|
|
||||||
if (x[4] == ' ')
|
if (x[4] == ' ')
|
||||||
{
|
{
|
||||||
busy = 0;
|
busy = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user