{
char *args = NULL;
int ret;
- if (!line || !*line)
- return 0;
PARA_DEBUG_LOG("line: %s\n", line);
ret = create_argv(line, " ", &conf.inputs);
int ret;
client_disconnect(ct);
- if (!line || !*line)
- return 0;
- PARA_DEBUG_LOG("line handler: %s\n", line);
+ PARA_DEBUG_LOG("line: %s\n", line);
ret = make_client_argv(line);
if (ret < 0)
return ret;
static void i9e_line_handler(char *line)
{
int ret;
- struct btr_node *dummy = btr_new_node(&(struct btr_node_description)
+ struct btr_node *dummy;
+
+ if (!line) {
+ i9ep->input_eof = true;
+ return;
+ }
+ if (!*line)
+ goto free_line;
+ rl_set_prompt("");
+ dummy = btr_new_node(&(struct btr_node_description)
EMBRACE(.name = "dummy line handler"));
i9e_attach_to_stdout(dummy);
-
ret = i9ep->ici->line_handler(line);
if (ret < 0)
PARA_WARNING_LOG("%s\n", para_strerror(-ret));
- rl_set_prompt("");
- if (line) {
- if (*line)
- add_history(line);
- free(line);
- } else
- i9ep->input_eof = true;
+ add_history(line);
btr_remove_node(&dummy);
+free_line:
+ free(line);
}
static int i9e_post_select(__a_unused struct sched *s, __a_unused struct task *t)
static int play_i9e_line_handler(char *line)
{
- struct play_task *pt = &play_task;
- int ret;
-
- if (line == NULL || !*line)
- return 0;
- ret = run_command(line, pt);
- if (ret < 0)
- return ret;
- return 0;
+ return run_command(line, &play_task);
}
static int play_i9e_key_handler(int key)