X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=client.c;h=4998222ea7c89df98ad55879a08f9dea1b5f6c6b;hp=f4a4ad50769cafcdd4ec0d0f0806e20b4ee13fcc;hb=4744d937c4160898d1fe151257606430750e580c;hpb=d16fe3df649cb48d5ffa26187da3dad4c3066646 diff --git a/client.c b/client.c index f4a4ad50..4998222e 100644 --- a/client.c +++ b/client.c @@ -1,10 +1,10 @@ /* - * Copyright (C) 1997-2011 Andre Noll + * Copyright (C) 1997-2012 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ -/** \file client.c the client program used to connect to para_server */ +/** \file client.c The client program used to connect to para_server. */ #include #include @@ -459,11 +459,6 @@ static int client_i9e_line_handler(char *line) return 1; } -static void client_sighandler(int s) -{ - i9e_signal_dispatch(s); -} - static struct i9e_completer completers[] = { SERVER_COMPLETERS AFS_COMPLETERS @@ -494,7 +489,7 @@ __noreturn static void interactive_session(void) } ici.history_file = history_file; - act.sa_handler = client_sighandler; + act.sa_handler = i9e_signal_dispatch; sigemptyset(&act.sa_mask); act.sa_flags = 0; sigaction(SIGINT, &act, NULL); @@ -601,21 +596,29 @@ int main(int argc, char *argv[]) */ sit.btrn = btr_new_node(&(struct btr_node_description) EMBRACE(.name = "stdin")); - ret = client_open(argc, argv, &ct, &client_loglevel, sit.btrn, NULL, &sched); + ret = client_connect(ct, &sched, sit.btrn, NULL); if (ret < 0) goto out; sot.btrn = btr_new_node(&(struct btr_node_description) EMBRACE(.name = "stdout", .parent = ct->btrn)); register_task(&sched, &svt); ret = schedule(&sched); + if (ret >= 0 && ct->task.error < 0) { + switch(ct->task.error) { + /* these are not errors */ + case -E_EOF: + case -E_SERVER_EOF: + case -E_BTR_EOF: + ret = 0; + break; + default: ret = ct->task.error; + } + } out: + if (ret < 0) + PARA_ERROR_LOG("%s\n", para_strerror(-ret)); client_close(ct); btr_free_node(sit.btrn); btr_free_node(sot.btrn); - if (ret < 0) { - /* can not use PARA_LOG here because ct is NULL */ - fprintf(stderr, "%s\n", para_strerror(-ret)); - return EXIT_FAILURE; - } - return EXIT_SUCCESS; + return ret < 0? EXIT_FAILURE : EXIT_SUCCESS; }