From e59147ed89bd287212dba28c13873e7ab3613a57 Mon Sep 17 00:00:00 2001 From: Saverio Proto Date: Fri, 4 Apr 2014 18:12:35 +0200 Subject: [PATCH] Working tinc_setup() function in the library --- src/libmeshlink.c | 5 ++++- src/libmeshlink.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libmeshlink.c b/src/libmeshlink.c index 4f2364bb..047bd3a0 100644 --- a/src/libmeshlink.c +++ b/src/libmeshlink.c @@ -22,6 +22,7 @@ #include "ecdsagen.h" char *hosts_dir = NULL; static char *name = NULL; +char *tinc_conf = NULL; /* @@ -193,8 +194,10 @@ int check_port(char *name) { return 0; } //tinc_setup() should basically do what cmd_init() from src/tincctl.c does, except it doesn't have to generate a tinc-up script. -bool tinc_setup(const char* tinc_conf, const char* name) { +bool tinc_setup(const char* confbase, const char* name) { make_names(); + xasprintf(&tinc_conf, "%s" SLASH "tinc.conf", confbase); + xasprintf(&hosts_dir, "%s" SLASH "hosts", confbase); if(!access(tinc_conf, F_OK)) { fprintf(stderr, "Configuration file %s already exists!\n", tinc_conf); return false; diff --git a/src/libmeshlink.h b/src/libmeshlink.h index 02a94484..4b313915 100644 --- a/src/libmeshlink.h +++ b/src/libmeshlink.h @@ -29,7 +29,7 @@ extern int check_port(char *name); /* OLD: tinc_configuration_t provides all information required to setup "/etc/tinc" I think tinc_setup() should basically do what cmd_init() from src/tincctl.c does, except it doesn't have to generate a tinc-up script. */ -bool tinc_setup(const char* tinc_conf, const char* name); +bool tinc_setup(const char* confbase, const char* name); bool tinc_start(const char* path); -- 2.39.2