]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - client.c
Merge branch 't/remove_sb_compat'
[paraslash.git] / client.c
index 44862ab987015948ef3e9f3c2d6b9fdd4e12e008..873edc163b3e5f5164307d647724cf6655ec0d5f 100644 (file)
--- a/client.c
+++ b/client.c
@@ -54,7 +54,7 @@ static void exec_pre_select(struct sched *s, struct task *t)
                sched_min_delay(s);
 }
 
-static void exec_post_select(__a_unused struct sched *s, struct task *t)
+static int exec_post_select(__a_unused struct sched *s, struct task *t)
 {
        struct exec_task *et = container_of(t, struct exec_task, task);
        struct btr_node *btrn = et->btrn;
@@ -63,10 +63,8 @@ static void exec_post_select(__a_unused struct sched *s, struct task *t)
        int ret;
 
        ret = btr_node_status(btrn, 0, BTR_NT_LEAF);
-       if (ret <= 0) {
-               t->error = ret;
-               return;
-       }
+       if (ret <= 0)
+               return ret;
        sz = btr_next_buffer(btrn, &buf);
        if (sz <= 1)
                goto out;
@@ -76,6 +74,7 @@ static void exec_post_select(__a_unused struct sched *s, struct task *t)
        et->result_buf[et->result_size - 1] = '\0';
 out:
        btr_consume(btrn, sz);
+       return 0;
 }
 
 static int make_client_argv(const char *line)
@@ -446,11 +445,9 @@ static int client_i9e_line_handler(char *line)
        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)
+       if (ret <= 0)
                return ret;
        ret = client_connect(ct, &sched, NULL, NULL);
        if (ret < 0)
@@ -478,7 +475,7 @@ __noreturn static void interactive_session(void)
                .completers = completers,
        };
 
-       PARA_NOTICE_LOG("\n%s\n", VERSION_TEXT("client"));
+       PARA_NOTICE_LOG("\n%s\n", version_text("client"));
        if (ct->conf.history_file_given)
                history_file = para_strdup(ct->conf.history_file_arg);
        else {
@@ -536,27 +533,25 @@ struct supervisor_task {
        struct task task;
 };
 
-static void supervisor_post_select(struct sched *s, struct task *t)
+static int supervisor_post_select(struct sched *s, struct task *t)
 {
        struct supervisor_task *svt = container_of(t, struct supervisor_task,
                task);
 
-       if (ct->task.error < 0) {
-               t->error = ct->task.error;
-               return;
-       }
+       if (ct->task.error < 0)
+               return ct->task.error;
        if (!svt->stdout_task_started && ct->status == CL_EXECUTING) {
                stdout_set_defaults(&sot);
                register_task(s, &sot.task);
                svt->stdout_task_started = true;
-               return;
+               return 1;
        }
        if (ct->status == CL_SENDING) {
                stdin_set_defaults(&sit);
                register_task(s, &sit.task);
-               t->error = -E_TASK_STARTED;
-               return;
+               return -E_TASK_STARTED;
        }
+       return 0;
 }
 
 static struct supervisor_task supervisor_task = {