#include <regex.h>
#include <sys/types.h>
-#include <dirent.h>
#include "para.h"
#include "error.h"
#include "client.cmdline.h"
#include "client.h"
#include "buffer_tree.h"
+#include "version.h"
/** The size of the receiving buffer. */
#define CLIENT_BUFSIZE 4000
free(ct->user);
free(ct->config_file);
free(ct->key_file);
+ btr_free_node(ct->btrn);
client_cmdline_parser_free(&ct->conf);
free(ct);
}
ct->user = ct->conf.user_given?
para_strdup(ct->conf.user_arg) : para_logname();
- ct->key_file = ct->conf.key_file_given?
- para_strdup(ct->conf.key_file_arg) :
- make_message("%s/.paraslash/key.%s", home, ct->user);
+ if (ct->conf.key_file_given)
+ ct->key_file = para_strdup(ct->conf.key_file_arg);
+ else {
+ ct->key_file = make_message("%s/.paraslash/key.%s",
+ home, ct->user);
+ if (!file_exists(ct->key_file)) {
+ free(ct->key_file);
+ ct->key_file = make_message("%s/.ssh/id_rsa", home);
+ }
+ }
if (loglevel)
*loglevel = get_loglevel_by_name(ct->conf.loglevel_arg);
if (ret < 0) {
PARA_ERROR_LOG("%s\n", para_strerror(-ret));
btr_remove_node(ct->btrn);
- btr_free_node(ct->btrn);
client_close(ct);
*ct_ptr = NULL;
}