0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

Fixes for include.

This commit is contained in:
Ondrej Zajicek 2011-10-10 01:01:58 +02:00
parent 1cb97af419
commit 9b7fdfc84a
4 changed files with 6 additions and 2 deletions

View File

@ -75,6 +75,7 @@ linpool *cfg_mem;
int (*cf_read_hook)(byte *buf, unsigned int max, int fd); int (*cf_read_hook)(byte *buf, unsigned int max, int fd);
int (*cf_open_hook)(char *filename); int (*cf_open_hook)(char *filename);
struct include_file_stack *ifs;
#define YY_INPUT(buf,result,max) result = cf_read_hook(buf, max, ifs->conf_fd); #define YY_INPUT(buf,result,max) result = cf_read_hook(buf, max, ifs->conf_fd);
#define YY_NO_UNPUT #define YY_NO_UNPUT

View File

@ -120,7 +120,7 @@ struct include_file_stack {
struct include_file_stack *next; struct include_file_stack *next;
}; };
struct include_file_stack *ifs; extern struct include_file_stack *ifs;
int cf_lex(void); int cf_lex(void);

View File

@ -224,7 +224,7 @@ static int cli_rh_trick_flag;
struct cli *this_cli; struct cli *this_cli;
static int static int
cli_cmd_read_hook(byte *buf, unsigned int max) cli_cmd_read_hook(byte *buf, unsigned int max, UNUSED int fd)
{ {
if (!cli_rh_trick_flag) if (!cli_rh_trick_flag)
{ {

View File

@ -171,11 +171,14 @@ cf_open(char *filename)
if (*filename != '/') { if (*filename != '/') {
snprintf(full_name, sizeof(full_name), "%s/%s", dirname(config_name), filename); snprintf(full_name, sizeof(full_name), "%s/%s", dirname(config_name), filename);
full_name[sizeof(full_name)-1] = 0;
cur = full_name; cur = full_name;
} }
if ((ret = open(cur, O_RDONLY)) == -1) if ((ret = open(cur, O_RDONLY)) == -1)
cf_error("Unable to open included configuration file: %s", cur); cf_error("Unable to open included configuration file: %s", cur);
return ret;
} }