diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sledjchisl/sledjchisl.c | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 5269806..da9a7e6 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c | |||
@@ -8084,12 +8084,36 @@ int scanForConfigs(char **cPaths) | |||
8084 | snprintf(toybuf, sizeof(toybuf), "%s", cPaths[i]); | 8084 | snprintf(toybuf, sizeof(toybuf), "%s", cPaths[i]); |
8085 | else | 8085 | else |
8086 | snprintf(toybuf, sizeof(toybuf), "%s/%s", pwd, cPaths[i]); | 8086 | snprintf(toybuf, sizeof(toybuf), "%s/%s", pwd, cPaths[i]); |
8087 | 8087 | V("Looking for config file %s", toybuf); | |
8088 | V("Looking for config file %s", toybuf); | ||
8089 | if (qfile_exist(toybuf)) | 8088 | if (qfile_exist(toybuf)) |
8090 | { | 8089 | { |
8090 | char *tmp; | ||
8091 | void *vd; | ||
8092 | |||
8091 | I("Loading configuration file (maybe) - %s", toybuf); | 8093 | I("Loading configuration file (maybe) - %s", toybuf); |
8092 | Lua2hashtbl(toybuf, configs, "config"); | 8094 | Lua2hashtbl(toybuf, configs, "config"); |
8095 | DEBUG = configs->getint(configs, "debug"); | ||
8096 | V("Setting DEBUG = %d", DEBUG); | ||
8097 | if ((vd = configs->get (configs, "loadAverageInc", NULL, false)) != NULL) {loadAverageInc = *((float *) vd); V("Setting loadAverageInc = %f", loadAverageInc);} | ||
8098 | if ((vd = configs->get (configs, "simTimeOut", NULL, false)) != NULL) {simTimeOut = (int) *((float *) vd); V("Setting simTimeOut = %d", simTimeOut);} | ||
8099 | if ((vd = configs->get (configs, "bulkSims", NULL, false)) != NULL) {bulkSims = (int) *((float *) vd); V("Setting bulkSims = %d", bulkSims);} | ||
8100 | if ((tmp = configs->getstr(configs, "scRoot", false)) != NULL) {scRoot = tmp; V("Setting scRoot = %s", scRoot);} | ||
8101 | if ((tmp = configs->getstr(configs, "scUser", false)) != NULL) {scUser = tmp; V("Setting scUser = %s", scUser);} | ||
8102 | if ((tmp = configs->getstr(configs, "Tconsole", false)) != NULL) {Tconsole = tmp; V("Setting Tconsole = %s", Tconsole);} | ||
8103 | if ((tmp = configs->getstr(configs, "Tsocket", false)) != NULL) {Tsocket = tmp; V("Setting Tsocket = %s", Tsocket);} | ||
8104 | if ((tmp = configs->getstr(configs, "Ttab", false)) != NULL) {Ttab = tmp; V("Setting Ttab = %s", Ttab);} | ||
8105 | if ((vd = configs->get (configs, "startPort", NULL, false)) != NULL) {startPort = (int) *((float *) vd); V("Setting startPort = %d", startPort);} | ||
8106 | if ((tmp = configs->getstr(configs, "backupIARsim", false)) != NULL) {backupIARsim = tmp; V("Setting backupIARsim = %s", backupIARsim);} | ||
8107 | if ((tmp = configs->getstr(configs, "rsync", false)) != NULL) {rSync = tmp; V("Setting rsync = %s", rSync);} | ||
8108 | if ((vd = configs->getstr(configs, "rsyncPort", false)) != NULL) {rSyncPort = (int) *((float *) vd); V("Setting rsyncPort = %s", rSyncPort);} | ||
8109 | if ((tmp = configs->getstr(configs, "webRoot", false)) != NULL) {webRoot = tmp; V("Setting webRoot = %s", webRoot);} | ||
8110 | if ((tmp = configs->getstr(configs, "URL", false)) != NULL) {URL = tmp; V("Setting URL = %s", URL);} | ||
8111 | if ((vd = configs->get (configs, "seshRenew", NULL, false)) != NULL) {seshRenew = (int) *((float *) vd); V("Setting seshRenew = %d", seshRenew);} | ||
8112 | if ((vd = configs->get (configs, "idleTimeOut", NULL, false)) != NULL) {idleTimeOut = (int) *((float *) vd); V("Setting idleTimeOut = %d", idleTimeOut);} | ||
8113 | if ((vd = configs->get (configs, "seshTimeOut", NULL, false)) != NULL) {seshTimeOut = (int) *((float *) vd); V("Setting seshTimeOut = %d", seshTimeOut);} | ||
8114 | if ((vd = configs->get (configs, "newbieTimeOut", NULL, false)) != NULL) {newbieTimeOut = (int) *((float *) vd); V("Setting newbieTimeOut = %d", newbieTimeOut);} | ||
8115 | if ((tmp = configs->getstr(configs, "ToS", false)) != NULL) {ToS = tmp; V("Setting ToS = %s", ToS);} | ||
8116 | if ((tmp = configs->getstr(configs, "webIframers", false)) != NULL) {webIframers = tmp; V("Setting webIframers = %s", webIframers);} | ||
8093 | result = TRUE; | 8117 | result = TRUE; |
8094 | } | 8118 | } |
8095 | } | 8119 | } |
@@ -8105,7 +8129,6 @@ void sledjchisl_main(void) | |||
8105 | char *tmp, *t0 = NULL, *t1 = NULL; | 8129 | char *tmp, *t0 = NULL, *t1 = NULL; |
8106 | struct stat statbuf; | 8130 | struct stat statbuf; |
8107 | int status, result, i; | 8131 | int status, result, i; |
8108 | void *vd; | ||
8109 | 8132 | ||
8110 | if(FLAG(v)) | 8133 | if(FLAG(v)) |
8111 | VERBOSE = TRUE; | 8134 | VERBOSE = TRUE; |
@@ -8211,8 +8234,8 @@ jit library is loaded or the JIT compiler will not be activated. | |||
8211 | 8234 | ||
8212 | /* Load the config scripts. | 8235 | /* Load the config scripts. |
8213 | Normally we start in /opt/opensim_SC | 8236 | Normally we start in /opt/opensim_SC |
8214 | sledjchisl here is a symlink to ../src/build/toybox/toybox or ../src/build/toybox/generated/unstripped/toybox | 8237 | current/bin/sledjchisl here is a symlink to ../src/build/toybox/toybox or ../src/build/toybox/generated/unstripped/toybox |
8215 | So that ./etc/.sledjChisl.conf.lua is found. | 8238 | So that etc/.sledjChisl.conf.lua is found. |
8216 | 8239 | ||
8217 | Other possibilities - | 8240 | Other possibilities - |
8218 | Normally sledjchisl isn't in the path, though it is once our tmux is running. | 8241 | Normally sledjchisl isn't in the path, though it is once our tmux is running. |
@@ -8225,21 +8248,14 @@ Other possibilities - | |||
8225 | // "/etc/sledjChisl.d/*.lua", | 8248 | // "/etc/sledjChisl.d/*.lua", |
8226 | "~/.sledjChisl.conf.lua", | 8249 | "~/.sledjChisl.conf.lua", |
8227 | // "~/.config/sledjChisl/*.lua", | 8250 | // "~/.config/sledjChisl/*.lua", |
8228 | NULL | 8251 | "etc/.sledjChisl.conf.lua", |
8229 | }; | ||
8230 | |||
8231 | char *oPaths[] = | ||
8232 | { | ||
8233 | ".sledjChisl.conf.lua", | 8252 | ".sledjChisl.conf.lua", |
8234 | "./etc/.sledjChisl.conf.lua", | ||
8235 | NULL | 8253 | NULL |
8236 | }; | 8254 | }; |
8237 | 8255 | ||
8238 | result = scanForConfigs(cPaths); | 8256 | result = scanForConfigs(cPaths); |
8239 | result = result || scanForConfigs(oPaths); | ||
8240 | if (result) | 8257 | if (result) |
8241 | { | 8258 | { |
8242 | if ((tmp = configs->getstr(configs, "scRoot", false)) != NULL) {scRoot = tmp; V("Setting scRoot = %s", scRoot);} | ||
8243 | snprintf(toybuf, sizeof(toybuf), "%s", scRoot); | 8259 | snprintf(toybuf, sizeof(toybuf), "%s", scRoot); |
8244 | t0 = realpath(pwd, NULL); | 8260 | t0 = realpath(pwd, NULL); |
8245 | t1 = realpath(toybuf, NULL); | 8261 | t1 = realpath(toybuf, NULL); |
@@ -8255,7 +8271,6 @@ Other possibilities - | |||
8255 | free(t0); | 8271 | free(t0); |
8256 | t0 = realpath(pwd, NULL); | 8272 | t0 = realpath(pwd, NULL); |
8257 | result = scanForConfigs(cPaths); | 8273 | result = scanForConfigs(cPaths); |
8258 | result = result | scanForConfigs(oPaths); | ||
8259 | } | 8274 | } |
8260 | else | 8275 | else |
8261 | { | 8276 | { |
@@ -8266,32 +8281,7 @@ Other possibilities - | |||
8266 | free(t1); | 8281 | free(t1); |
8267 | } | 8282 | } |
8268 | 8283 | ||
8269 | if (result) | 8284 | if (!result) |
8270 | { | ||
8271 | DEBUG = configs->getint(configs, "debug"); | ||
8272 | V("Setting DEBUG = %d", DEBUG); | ||
8273 | if ((vd = configs->get (configs, "loadAverageInc", NULL, false)) != NULL) {loadAverageInc = *((float *) vd); V("Setting loadAverageInc = %f", loadAverageInc);} | ||
8274 | if ((vd = configs->get (configs, "simTimeOut", NULL, false)) != NULL) {simTimeOut = (int) *((float *) vd); V("Setting simTimeOut = %d", simTimeOut);} | ||
8275 | if ((vd = configs->get (configs, "bulkSims", NULL, false)) != NULL) {bulkSims = (int) *((float *) vd); V("Setting bulkSims = %d", bulkSims);} | ||
8276 | if ((tmp = configs->getstr(configs, "scRoot", false)) != NULL) {scRoot = tmp; V("Setting scRoot = %s", scRoot);} | ||
8277 | if ((tmp = configs->getstr(configs, "scUser", false)) != NULL) {scUser = tmp; V("Setting scUser = %s", scUser);} | ||
8278 | if ((tmp = configs->getstr(configs, "Tconsole", false)) != NULL) {Tconsole = tmp; V("Setting Tconsole = %s", Tconsole);} | ||
8279 | if ((tmp = configs->getstr(configs, "Tsocket", false)) != NULL) {Tsocket = tmp; V("Setting Tsocket = %s", Tsocket);} | ||
8280 | if ((tmp = configs->getstr(configs, "Ttab", false)) != NULL) {Ttab = tmp; V("Setting Ttab = %s", Ttab);} | ||
8281 | if ((vd = configs->get (configs, "startPort", NULL, false)) != NULL) {startPort = (int) *((float *) vd); V("Setting startPort = %d", startPort);} | ||
8282 | if ((tmp = configs->getstr(configs, "backupIARsim", false)) != NULL) {backupIARsim = tmp; V("Setting backupIARsim = %s", backupIARsim);} | ||
8283 | if ((tmp = configs->getstr(configs, "rsync", false)) != NULL) {rSync = tmp; V("Setting rsync = %s", rSync);} | ||
8284 | if ((vd = configs->getstr(configs, "rsyncPort", false)) != NULL) {rSyncPort = (int) *((float *) vd); V("Setting rsyncPort = %s", rSyncPort);} | ||
8285 | if ((tmp = configs->getstr(configs, "webRoot", false)) != NULL) {webRoot = tmp; V("Setting webRoot = %s", webRoot);} | ||
8286 | if ((tmp = configs->getstr(configs, "URL", false)) != NULL) {URL = tmp; V("Setting URL = %s", URL);} | ||
8287 | if ((vd = configs->get (configs, "seshRenew", NULL, false)) != NULL) {seshRenew = (int) *((float *) vd); V("Setting seshRenew = %d", seshRenew);} | ||
8288 | if ((vd = configs->get (configs, "idleTimeOut", NULL, false)) != NULL) {idleTimeOut = (int) *((float *) vd); V("Setting idleTimeOut = %d", idleTimeOut);} | ||
8289 | if ((vd = configs->get (configs, "seshTimeOut", NULL, false)) != NULL) {seshTimeOut = (int) *((float *) vd); V("Setting seshTimeOut = %d", seshTimeOut);} | ||
8290 | if ((vd = configs->get (configs, "newbieTimeOut", NULL, false)) != NULL) {newbieTimeOut = (int) *((float *) vd); V("Setting newbieTimeOut = %d", newbieTimeOut);} | ||
8291 | if ((tmp = configs->getstr(configs, "ToS", false)) != NULL) {ToS = tmp; V("Setting ToS = %s", ToS);} | ||
8292 | if ((tmp = configs->getstr(configs, "webIframers", false)) != NULL) {webIframers = tmp; V("Setting webIframers = %s", webIframers);} | ||
8293 | } | ||
8294 | else | ||
8295 | { | 8285 | { |
8296 | C("No sledjChisl.conf.lua found!"); | 8286 | C("No sledjChisl.conf.lua found!"); |
8297 | goto finished; | 8287 | goto finished; |