Commit d19617f0 authored by Ondrej Zajicek (work)'s avatar Ondrej Zajicek (work)
Browse files

Merge remote-tracking branch 'origin/int-new' into int-new

parents 144c10fa 31874783
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -29,6 +29,9 @@ static int prompt_active;
extern int _rl_vis_botlin;
extern void _rl_move_vert(int);

#define HISTORY "/.birdc_history"
static char *history_file;

static void
add_history_dedup(char *cmd)
{
@@ -137,9 +140,25 @@ input_help(int arg, int key UNUSED)
  return 0;
}

void
history_init(void)
{
  const char *homedir = getenv("HOME");
  if (!homedir)
    homedir = ".";
  history_file = malloc(strlen(homedir) + sizeof(HISTORY));
  if (!history_file)
    die("couldn't alloc enough memory for history file name");

  sprintf(history_file, "%s%s", homedir, HISTORY);
  read_history(history_file);
}

void
input_init(void)
{
  if (interactive)
    history_init();
  rl_readline_name = "birdc";
  rl_add_defun("bird-complete", input_complete, '\t');
  rl_add_defun("bird-help", input_help, '?');
@@ -217,5 +236,7 @@ cleanup(void)
    return;

  input_hide();
  if (interactive)
    write_history(history_file);
  rl_callback_handler_remove();
}
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +89,7 @@ struct config *
config_alloc(const char *name)
{
  pool *p = rp_new(&root_pool, "Config");
  linpool *l = lp_new(p, 4080);
  linpool *l = lp_new_default(p);
  struct config *c = lp_allocz(l, sizeof(struct config));

  /* Duplication of name string in local linear pool */
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ run_function(const void *parsed_fn_def)
  /* XXX: const -> non-const */
  struct f_inst *f = (struct f_inst *) parsed_fn_def;

  linpool *tmp = lp_new(&root_pool, 4096);
  linpool *tmp = lp_new_default(&root_pool);
  struct f_val res = f_eval(f, tmp);
  rfree(tmp);

+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ start_conf_env(void)
  bt_bird_init();

  pool *p = rp_new(&root_pool, "helper_pool");
  linpool *l = lp_new(p, 4080);
  linpool *l = lp_new_default(p);
  cfg_mem = l;
}

+2 −2
Original line number Diff line number Diff line
@@ -401,7 +401,7 @@ t_builder4(void)
  resource_init();

  struct flow_builder *fb = flow_builder_init(&root_pool);
  linpool *lp = lp_new(&root_pool, 4096);
  linpool *lp = lp_new_default(&root_pool);

  /* Expectation */

@@ -482,7 +482,7 @@ t_builder6(void)
  net_addr_ip6 ip;

  resource_init();
  linpool *lp = lp_new(&root_pool, 4096);
  linpool *lp = lp_new_default(&root_pool);
  struct flow_builder *fb = flow_builder_init(&root_pool);
  fb->ipv6 = 1;

Loading