Beispiel #1
0
void
execute_cmd_post_hook (struct cmd_list_element *c)
{
  if ((c->hook_post) && (!c->hook_in))
    {
      scoped_restore_hook_in restore_hook (c);
      c->hook_in = 1; /* Prevent recursive hooking.  */
      execute_user_command (c->hook_post, nullptr);
    }
}
Beispiel #2
0
void
execute_cmd_pre_hook (struct cmd_list_element *c)
{
  if ((c->hook_pre) && (!c->hook_in))
    {
      struct cleanup *cleanups = make_cleanup (clear_hook_in_cleanup, c);
      c->hook_in = 1; /* Prevent recursive hooking.  */
      execute_user_command (c->hook_pre, (char *) 0);
      do_cleanups (cleanups);
    }
}
Beispiel #3
0
static void process_input(brl_t *brl, const char *input, void *user_data)
{
    client_t *c   = (client_t *)user_data;
    int       len = input ? strlen(input) + 1 : 0;
    char      buf[len], *args[64];
    int       narg;

    if (len > 1) {
        brl_add_history(brl, input);
        hide_prompt(c);

        strcpy(buf, input);
        narg = split_input(buf, MRP_ARRAY_SIZE(args), args);
        if (narg > 0)
            execute_user_command(c, narg, &args[0]);
        else
            printf("failed to parse input '%s'\n", input);

        show_prompt(c);
    }
}