- openlogger(identname, use_logfile?LOGMODE_FILE:(do_detach?LOGMODE_SYSLOG:LOGMODE_STDERR));
-
- logger(DEBUG_ALWAYS, LOG_NOTICE, "tincd %s (%s %s) starting, debug level %d",
- VERSION, __DATE__, __TIME__, debug_level);
-
- return true;
-}
-
-bool execute_script(const char *name, char **envp) {
-#ifdef HAVE_SYSTEM
- int status, len;
- char *scriptname;
- int i;
- char *interpreter = NULL;
-
-#ifndef HAVE_MINGW
- len = xasprintf(&scriptname, "\"%s" SLASH "%s\"", confbase, name);
-#else
- len = xasprintf(&scriptname, "\"%s" SLASH "%s.bat\"", confbase, name);
-#endif
- if(len < 0)
- return false;
-
- scriptname[len - 1] = '\0';
-
-#ifndef HAVE_TUNEMU
- /* First check if there is a script */
-
- if(access(scriptname + 1, F_OK)) {
- free(scriptname);
- return true;
- }
-#endif
-
- // Custom scripts interpreter
- if(get_config_string(lookup_config(config_tree, "ScriptsInterpreter"), &interpreter)) {
- // Force custom scripts interpreter allowing execution of scripts on android without execution flag (such as on /sdcard)
- free(scriptname);
- len = xasprintf(&scriptname, "%s \"%s/%s\"", interpreter, confbase, name);
- free(interpreter);
- if(len < 0)
- return false;
- }
-
- logger(DEBUG_STATUS, LOG_INFO, "Executing script %s", name);
-
-
-#ifdef HAVE_PUTENV
- /* Set environment */
-
- for(i = 0; envp[i]; i++)
- putenv(envp[i]);
-#endif
-
- scriptname[len - 1] = '\"';
- status = system(scriptname);
-
- free(scriptname);