X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=client.c;h=75519091670b73297ffd9e7010756c4eb6784f5e;hb=refs%2Fheads%2Fpu;hp=36e851f4b571a2dc095290f18f5e0d96afc5331e;hpb=5967ac5353739c3ff571dd12d4c6814fa8493ad8;p=paraslash.git diff --git a/client.c b/client.c index 36e851f4..661aff8f 100644 --- a/client.c +++ b/client.c @@ -347,7 +347,7 @@ static void setatt_completer(struct i9e_completion_info *ci, if (ret < 0) goto out; num_atts = ret; - sl = para_realloc(sl, (2 * num_atts + 1) * sizeof(char *)); + sl = arr_realloc(sl, 2 * num_atts + 1, sizeof(char *)); for (i = 0; i < num_atts; i++) { char *orig = sl[i]; sl[i] = make_message("%s+", orig); @@ -441,7 +441,7 @@ static void select_completer(struct i9e_completion_info *ci, goto free_moods; num_pl = ret; n = num_moods + num_pl; - mops = para_malloc((n + 1) * sizeof(char *)); + mops = arr_alloc(n + 1, sizeof(char *)); for (i = 0; i < num_moods; i++) mops[i] = make_message("m/%s", moods[i]); for (i = 0; i < num_pl; i++) @@ -525,15 +525,9 @@ __noreturn static void interactive_session(void) }; PARA_NOTICE_LOG("\n%s\n", version_text("client")); - if (CLIENT_OPT_GIVEN(HISTORY_FILE, ct->lpr)) - ici.history_file = para_strdup(CLIENT_OPT_STRING_VAL( - HISTORY_FILE, ct->lpr)); - else { - char *home = para_homedir(); - ici.history_file = make_message("%s/.paraslash/client.history", - home); - free(home); - } + ici.history_file = CLIENT_OPT_GIVEN(HISTORY_FILE, ct->lpr)? + para_strdup(CLIENT_OPT_STRING_VAL(HISTORY_FILE, ct->lpr)) : + make_message("%s/client.history", get_confdir()); act.sa_handler = i9e_signal_dispatch; sigemptyset(&act.sa_mask); act.sa_flags = 0; @@ -549,6 +543,7 @@ __noreturn static void interactive_session(void) i9e_close(); para_log = stderr_log; out: + free(ici.history_file); if (ret < 0) PARA_ERROR_LOG("%s\n", para_strerror(-ret)); exit(ret < 0? EXIT_FAILURE : EXIT_SUCCESS); @@ -666,8 +661,6 @@ int main(int argc, char *argv[]) /* these are not errors */ case -E_SERVER_CMD_SUCCESS: case -E_EOF: - case -E_SERVER_EOF: - case -E_BTR_EOF: ret = 0; break; default: ret = -E_SERVER_CMD_FAILURE; @@ -682,5 +675,6 @@ out: client_close(ct); btr_remove_node(&sit.btrn); btr_remove_node(&sot.btrn); + free(get_confdir()); return ret < 0? EXIT_FAILURE : EXIT_SUCCESS; }