-/*
- Set all files and paths according to netname
-*/
-static void make_names(void) {
-#ifdef HAVE_MINGW
- HKEY key;
- char installdir[1024] = "";
- long len = sizeof installdir;
-#endif
-
- if(netname)
- xasprintf(&identname, "tinc.%s", netname);
- else
- identname = xstrdup("tinc");
-
-#ifdef HAVE_MINGW
- if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) {
- if(!RegQueryValueEx(key, NULL, 0, 0, installdir, &len)) {
- if(!confbase) {
- if(netname)
- xasprintf(&confbase, "%s" SLASH "%s", installdir, netname);
- else
- xasprintf(&confbase, "%s", installdir);
- }
- }
- if(!pidfilename)
- xasprintf(&pidfilename, "%s" SLASH "pid", confbase);
- RegCloseKey(key);
- }
-
- if(!*installdir) {
-#endif
- confdir = xstrdup(CONFDIR);
-
- if(!pidfilename)
- xasprintf(&pidfilename, "%s" SLASH "run" SLASH "%s.pid", LOCALSTATEDIR, identname);
-
- if(netname) {
- if(!confbase)
- xasprintf(&confbase, CONFDIR SLASH "tinc" SLASH "%s", netname);
- else
- fprintf(stderr, "Both netname and configuration directory given, using the latter...\n");
- } else {
- if(!confbase)
- xasprintf(&confbase, CONFDIR SLASH "tinc");
- }
-
-#ifdef HAVE_MINGW
- } else
- confdir = xstrdup(installdir);
-#endif
-
- xasprintf(&tinc_conf, "%s" SLASH "tinc.conf", confbase);
- xasprintf(&hosts_dir, "%s" SLASH "hosts", confbase);
-}
-