# Simple Makefile
CC=gcc
-LIBS= -lcrypto -lz -llzo2 -ldl -lpthread -L../src/.libs/ -lmeshlink
+LIBS= -L../src/.libs/ -lmeshlink -lcrypto -lz -ldl -lpthread -static
INCLUDE= -I../src/
LOADLIBES= $(LIBS)
OBJS= meshlinkapp.o
int main(int argc , char **argv){
-char *confbase = "/tmp/meshlink/";
-char *name = "test";
+char *confbase = argc > 1 ? argv[1] : "/tmp/meshlink/";
+char *name = argc > 2 ? argv[2] : "foo";
debug_level = 5;
node_t* remotenode = new_node();
-char *remotename = "ml";
+char *remotename = argc > 3 ? argv[3] : "bar";
//TODO: change this, calling a function that returns node_t
remotenode->name = malloc(16);
return true;
}
+__attribute__((constructor)) static void meshlink_init(void) {
+ /* Slllluuuuuuurrrrp! */
+
+ gettimeofday(&now, NULL);
+ srand(now.tv_sec + now.tv_usec);
+ crypto_init();
+}
+
+__attribute__((destructor)) static void meshlink_exit(void) {
+ crypto_exit();
+}
+
+
bool tinc_main_thread(void * in) {
static bool status = false;
init_configuration(&config_tree);
- /* Slllluuuuuuurrrrp! */
-
- gettimeofday(&now, NULL);
- srand(now.tv_sec + now.tv_usec);
- crypto_init();
-
if(!read_server_config())
return false;
//free(priority);
- crypto_exit();
-
exit_configuration(&config_tree);
return status;
return true;
}
-int main(int argc, char **argv) {
+int old_main(int argc, char **argv) {
if(!parse_options(argc, argv))
return 1;